I'm using a sandboxed solution, this is the error I got when I try to make the txt
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. sharepoint
This is the code I have for creating and writting on the file
string path = @"C:\pruebas\" + txtNombre.Text + ".txt";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))//here happens the error
{
sw.WriteLine("Hello");
sw.WriteLine(Texto);
}
}
using (StreamReader sr = File.OpenText(path))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
}
@
, which using means a literal string. Try to spit out the path variable to make sure it is valid.