Creating directories in medium trust environment?
问题 I've got an ASP.NET Web Application running in a medium trust environment with a shared hosting provider. The following code causes a SecurityException to be thrown: private void TestButton_Click(object sender, EventArgs e) { string directory = Server.MapPath("~/MyFolder/") + "_TestDirectory"; if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); } The full text of the error is: System.Security.SecurityException: Request for the permission of type 'System.Security