Request for the permission of type 'System.Web.AspNetHostingPermission' failed

Last post 09-30-2009 3:41 PM by jhlavenka. 9 replies.

Sort Posts:

  • Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    08-01-2007, 3:25 PM
    • Member
      326 point Member
    • ataxia1
    • Member since 05-01-2007, 3:16 PM
    • Posts 159

    Built a web app on my local machine, and it works perfectly.  Moved everything over to the production server (still editing and building from my local machine to the UNC path  \\123.456.789.0\Share\SiteName), and I receive the following error (25 times) when building the project: 

    Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    \\[SERVER NAME]\[FOLDERNAME]\orders-edit.aspx 196
     

    I receive one error per Ajax Control Toolkit control in the project.

    Found a couple other posts with similar issues and tried everything listed in those, including:

    - Generating a new (clean) web.config with defaults only
    - Turning on 'Script & Executable' permissions on the virtual web
    - Defining classes with unlimited rights
    - Manually importing the Ajax System.XX dlls directly into the BIN folder
    - Reinstalling AJAX on the server
    - Setting the production server name under Website > Start Options
    - Giving IUSR/IWAM/All Users execute rights to the BIN folder (yes... reaching for anything that even MIGHT work at this point)
    - IISReset

    I've pretty much exhausted every article I could find, and the error hasn't changed in the slightest.

    Any senior admins or developers out there willing to lend a hand?

    I would post code, but I'm fairly confident this is a problem with either permissions or the server settings since everything works perfectly from the development box.

    I'd really appreciate the help.

    Thanks!

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    08-01-2007, 6:50 PM
    Answer
    • Contributor
      2,148 point Contributor
    • Phanatic
    • Member since 10-07-2005, 3:48 AM
    • Redmond , WA
    • Posts 396

    Hi,

     I think you are running into CASPOL issues as your content resides on a remote share :

    Review this kb article which talks about similar issues :

    "System.Security.SecurityException: Security error" error message when the virtual directory points to a remote share in ASP.NET

    and also :

    Troubleshooting common permissions and security-related issues in ASP.NET

    Hope this helps

    Phani Raj
    http://blogs.msdn.com/PhaniRaj
  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    08-01-2007, 8:44 PM
    Answer
    • Member
      326 point Member
    • ataxia1
    • Member since 05-01-2007, 3:16 PM
    • Posts 159

    Links were corrupted in the above post.  Here they are for anyone else following this thread:

    "System.Security.SecurityException: Security error" error message when the virtual directory points to a remote share in ASP.NET
    http://support.microsoft.com/?id=320268
    The application is local to the server, (C:\inetpub\etc...) not on a remote share.  I am programming and building the project from a remote workstation.  Are there special procedures to build a site with Ajax Controls and the Control Toolkit when you are working from a remote workstation?

    Troubleshooting common permissions and security-related issues in ASP.NET
    http://support.microsoft.com/?id=910449
    I'll take a look at these.  Our server is at another building and controlled by a different department.  Let's hope they are in the mood for some in-depth toubleshooting.

    Thanks for the suggestions; I will give them a shot.

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    08-02-2007, 2:14 PM
    Answer
    • Member
      326 point Member
    • ataxia1
    • Member since 05-01-2007, 3:16 PM
    • Posts 159

    I've seen tons of posts on this error, and all seem to have different resolutions.

    Here's how I fixed mine:

    Instead of creating a new AJAX-enabled site on the remote server and copying in my files, I created an empty virtual web.

    Then, I published  (In VB:  Build > Publish Web Site > \\IP.IP.IP.IP\Share$\) the working project to the web server.  Publishing made it a self-contained package that works just fine.

    Hope this helps someone.

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    11-08-2007, 11:22 PM
    • Member
      80 point Member
    • sbritto
    • Member since 05-20-2003, 6:58 PM
    • Posts 21

     Thank you for saving the day! Your link to this Microsoft article worked beautifully. I was about to change the code on my AJAX enabled website.

    http://support.microsoft.com/?id=320268 

     

    Just wanted to return the favour and help anyone who encounters this error

     

    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.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:


    [SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
       System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
       System.Web.UI.NamespaceTagNameToTypeMapper.System.Web.UI.ITagNameToTypeMapper.GetControlType(String tagName, IDictionary attribs) +85
       System.Web.UI.TagPrefixTagNameToTypeMapper.System.Web.UI.ITagNameToTypeMapper.GetControlType(String tagName, IDictionary attribs) +105
       System.Web.UI.MainTagNameToTypeMapper.GetControlType(String tagName, IDictionary attribs, Boolean fAllowHtmlTags) +253
       System.Web.UI.RootBuilder.GetChildControlType(String tagName, IDictionary attribs) +20
       System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty) +127
       System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) +427
       System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) +893

     


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
     

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    11-22-2007, 8:58 AM
    • Member
      8 point Member
    • Phr34ker
    • Member since 11-22-2007, 1:52 PM
    • Posts 12

    The file:////\\server\sharename\*  -solution worked great for me, and I had a different error. I had the extremely annoying:

    SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    That pops up its ugly head waaaay to often in a multitude of situations (I believe I've gotten that error for 6 different things that has been wrong by now, but this solution was the one that solved the last one - and perhaps even had solved the otherones aswell, had I only seen it sooner).
    That message is about as helful as most girlfriends policy: "If you don't know what made me angry, I'm sure as hell not going to tell you either..."

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    02-02-2009, 11:12 AM
    • Member
      2 point Member
    • Fozzy279
    • Member since 02-02-2009, 3:02 PM
    • Posts 1

     I'm getting the error on my local machine when trying to run/debug the site. On another machine, I get the error when trying to add the AJAX control toolkit into VS2008. The solution suggeated doesn't seem to work as a) its not running on a web server - the virtual site created by VS2008 and secondly I can't even add the controls.... Seems something that should be simple is made extremeley difficult!! Any idea on my problems?

     

    Regards

     

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    03-04-2009, 8:58 AM
    • Member
      246 point Member
    • BugSlayer
    • Member since 02-23-2006, 9:43 PM
    • Mechanicsburg
    • Posts 58
    I was facing a similar issue,as the code files were stored on a mapped location, not on my local machine.I moved the entire webapp folder to my local drive and it compiled beautifully !Try doing this to make sure that is really the only-problem, before investing hours to fix it.

     

    "Our truest life is when we are in dreams awake." - Henry David Thoreau
  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    08-05-2009, 3:18 PM
    • Member
      153 point Member
    • jwkeenan
    • Member since 07-13-2006, 9:55 PM
    • Denver
    • Posts 130

    I was able to fix this issue by simply deleting the application in IIS and adding it back, not sure what caused it but this fixed it for me.

  • Re: Request for the permission of type 'System.Web.AspNetHostingPermission' failed

    09-30-2009, 3:41 PM
    • Member
      2 point Member
    • jhlavenka
    • Member since 09-30-2009, 3:40 PM
    • Posts 1

    Yay! The first link worked for me, thanks!

Page 1 of 1 (10 items)