Error while Creating Folder in ASp.net 1.1 (Security Exception)

Last post 10-15-2007 6:27 AM by XiaoYong Dai – MSFT. 4 replies.

Sort Posts:

  • Error while Creating Folder in ASp.net 1.1 (Security Exception)

    10-10-2007, 8:37 AM

    Hi all,

     I am trying to create a sub folder in my web application. on my local server it is working fine but my hosting server it is giving some security exception as follows,

     

    URL for page is : http://www.radiomusic.com/folder.aspx

     

    can anybody help me out its really urgent....  

     

    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:

    [No relevant source lines]

    Source File: App_Web_folder.aspx.cdcab7d2.odnuii0d.0.cs    Line: 0

    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() +59
    System.IO.Directory.InternalCreateDirectory(String fullPath, String path, DirectorySecurity dirSecurity) +458
    System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity) +150
    System.IO.Directory.CreateDirectory(String path) +6
    RadioMusic.App_Code.FileIO.CreateFolder(String path) in fileio.cs:19
    RadioMusic.folder.btnCreateDirectory_Click(Object sender, EventArgs e) in folder.aspx.cs:56
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
    System.Web.UI.Page.ProcessRequest() +86
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.folder_aspx.ProcessRequest(HttpContext context) in App_Web_folder.aspx.cdcab7d2.odnuii0d.0.cs:0
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


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


     

  • Re: Error while Creating Folder in ASp.net 1.1 (Security Exception)

    10-12-2007, 3:09 AM
    Answer

    Hi

    What happens in your code is the application attempted to perform IO operation which not allowed by the security policy. For testing purposes
    You can try to add this line in your web.config

      <system.web>
        <trust level="Full" originUrl="" />
      </system.web>

    Here you can get more information

    http://support.microsoft.com/?kbid=555466&SD=tech

    A more prosaic approach is looking into the call stack and figure out what was throwing exception and using the custom permission set for security policy.

     

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Error while Creating Folder in ASp.net 1.1 (Security Exception)

    10-12-2007, 3:17 AM

    Hi,

    you have to ask you server administrator to set access for creating new things for you application folder... 

    Vasanthakumar
    Software Engineer.
  • Re: Error while Creating Folder in ASp.net 1.1 (Security Exception)

    10-12-2007, 5:59 AM

    Thanks for you help Smile.

     I have tried this but giving me the syntax error in web.config file.....

    Also one thing that I noticed in Error messages is that the the error is generated by the .net framework 2.0,

    This mean that my host is using .net framework 2.0 and I compiled this site in framework 1.1.

    so is this is the problem associated with the .net framework? if yes then changing version of framework 2.0 to 1.1 on Hosting server will solve my issue?

     


     

  • Re: Error while Creating Folder in ASp.net 1.1 (Security Exception)

    10-15-2007, 6:27 AM

    meetpravin123:

     I have tried this but giving me the syntax error in web.config file.....

    Hi

    Is this message about ".config setting 'allowOverride' is set to 'false' ......"? If so, it means host administrator has locked the security policy and you are not permitted to override it.

    Please contact your web hosting company and ask them to customize your trust level so that your website can function properly. 

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter