Salve a tutti, in un sito che gestisco ho creato una semplice procedura che scrive su un file txt un log degli accessi al sito.
Tutto funzionava finché i proprietari del sito non hanno deciso di cambiare server.
Ora quando la procedura tenta di scrivere su disco genera questo errore

codice:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.IO.Path.GetTempPath() at System.IO.Path.GetTempFileName() at APD.MLogin.Authentication(String mobile, String password) in D:\Siti web\apd-local\APD\Login.aspx.cs:line 122 The action that failed was: Demand The type of the first permission that failed was: System.Security.Permissions.EnvironmentPermission The Zone of the assembly that failed was: Intranet

La parte di codice che genera l'errore è questa
codice:
string path = Request.PhysicalApplicationPath + "/log.txt";
 if (!File.Exists(path)) { 
File.Create(path);
 } 
this.roleId = r.GetInt32(4);
 if (this.roleId == 1) { 
Session.Add("role", "Tradesman");
 string tempfile = Path.GetTempFileName();
 StreamWriter writer = new StreamWriter(tempfile);
 StreamReader reader = new StreamReader(path); writer.WriteLine("Tradesman: " + r.GetString(2) +" " +r.GetString(6) + " Mobile: "+r.GetString(0)+" " + DateTime.Now.ToString()); while (!reader.EndOfStream) writer.WriteLine(reader.ReadLine());
 writer.Close();
 reader.Close();
 File.Copy(tempfile, path, true);
Ho già provato a inserire nel web.config
codice:
<trust level="Full"/>
Ma a quanto pare il server è configurato in modo che non si possano sovrascrivere le impostazioni di sicurezza.
Qualcuno ha idea su come possa fare per risolvere il problema?