Everytime i upload the beta i get a security error

Topics: Developer Forum, Localization Forum, Project Management Forum, User Forum
Sep 22, 2009 at 7:28 PM

 

Server Error in '/' Application.

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error: 


Line 15: 
Line 16: if (!Directory.Exists(galleryPath))
Line 17: Directory.CreateDirectory(galleryPath);
Line 18: 
Line 19: ftbEditor.ImageGalleryUrl = ResolveUrl(string.Format("~/ftb.imagegallery.aspx?rif={0}&cif={0}", galleryPath));

Source File: d:\hosting\sarahandrichie\SectionControls\HtmlEditor.ascx.cs Line: 17 

Stack Trace: 


[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity) +138
System.IO.Directory.CreateDirectory(String path) +6
SectionControls_HtmlEditor.OnInit(EventArgs e) in d:\hosting\sarahandrichie\SectionControls\HtmlEditor.ascx.cs:17
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.AddedControl(Control control, Int32 index) +198
System.Web.UI.ControlCollection.Add(Control child) +80
_Default.Page_Init(Object sender, EventArgs e) in d:\hosting\sarahandrichie\Default.aspx.cs:114
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnInit(EventArgs e) +99
System.Web.UI.Page.OnInit(EventArgs e) +12
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
System.Web.UI.Page.ProcessRequest() +80
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) in App_Web__om8nwel.12.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Can Anyone help??

 

 

Sep 27, 2009 at 6:07 PM

I posted this in the bug section a few weeks ago... The fix I did was to change line 14 to

string galleryPath = Server.MapPath("~/App_Data/UserImages/Image");

The Server.MapPath in place of the ResolveURL works much better.