System.Web.AspNetHostingPermission Failed Error – .NET 2.0 June 18, 2006
Posted by judismith in .NET 2.0.trackback
I recently purchased some ASP.NET 2.0 components. One of these components is a report generation component. I was anxious to try it out since like the rest of you I always have a ton of reporting to create. So I plunked the control on the default.aspx page, set the parameters, one of which included a reference to the demo NWind.mdb database in my file system. When I went to build the site, I kept coming up with the System.Web.AspNetHostingPermission blah blah blah Failed error.
So of course, I turn to Google to try to solve the problem. Well I came up with tons of people who had this problem or some variant but not too many solutions. There was either no answer to the post or there was the security expert answer to the problem which involved a whole lot more theory than I wanted at the moment. I just wanted a simple solution to get a simple test program to complie and run.
Finally I got it. Here are the steps needed to fix the problem:
1) Run the MMC (Start -> Run -> MMC, Enter)
2) Add the Mscorcfg.msc snap-in which is a graphical interface to the .NET 2.0 Configuration Tool. (Select File -> Add/Remove Snap In …). Click the Add button and select .NET Framework 2.0 Configuration from the list of snap-ins that appear. Click the Add button.
3) Navigate to and click on Runtime Security Policy. Click on Adjust Zone Security.

4) In the window that pops up, select from either “Make changes to this computer” or “Make changes for the current user only”. In the next screen, select Intranet and move the slider to full. Close out of the windows as appropriate.
If you did all this while Visual Studio was open, close Visual Studio and reopen it. Compile your project and you should be good to go.
WOW. After searcing for a whole day here the solution. REALLY TANK YOU.
I was having the same problem tryng FREETEXTBOX, and now i’ve the solution.
Tanks again.
Me too!
Hi,
Great article. Thanks.
FYI I just ran the “Microsoft .NET Framework 2.0 Configuration” app directly instead of steps 1 and 2 above.
The above solution did not fix my System.Web.AspNetHostingPermission blah blah blah Failed error. To fix my error i had to give Full control to Internet Zone which i didnt really want to do. My situation (for others) was i was mapping an IIS virtual directory to a path on my PC that was not physically under c:\inetpub\wwwroot e.g. P:\is\MyApp – in the browser i noticed the zone changed from Local Intranet to Internet and back to Local Intranet. Allowing Full control to Internet is the only current solution i have for this – note if the physical dir is under wwwroot the problem does not surface. Thanks again.
Lovely thanks man…. Sorted
Thanks alot !
I just faced this problem today first time and I spend 3 hours to search the search the solution. Finally I find this page. Thanks again for saving my time.
That right! It works.
I had the problem after installing The Ajax Control Toolkit from ASP.NET.
Following this guide solved my problem.
Thanks a Lot!
Koen
This was driving me nuts trying to get CSLA working. Thanks for the solution. You rock!
Dude! You ROCK! I’ve been pulling my hair (what little I have) out for about 5 hours trying to figure this error out! Many, many thanks!
Johnny B: I had the same issue.
I solved it like this:
First open Runtime Security Policy->Machine->Code Groups.
Then rightclick “All_Code” and choose “New…” in the popupmenu.
Enter a suatable name and click next.
In the condition type dropdown choose URL. and in the URL textfield enter the url to your site followed by “/*”. Click next.
Select “full trust” in the dropdown. Click next and then Finish
WOW…WOW…WOW….
YOU ARE THE BEST. THANK YOU SO MUCH. THAT DID IT.
WHOOOO
I’M HAPPY.
Slam Dunk – yet another Thank You!
Fantastic Solution – Great it works like a charm !!!!
UHHHHHHHHHHHHHHHHHHhhhh
Thank you! You’re dead on – lots of people with the problem, no solutions; saved me wasting a lot more time and I learned something.
Thanks a lot, great article. It helps a lot.
Worked like a charm, thank you very much.
I’m also hours into the problem, but this did not work for me.
I am trying to install the AjaxControlToolkit in Visual Studio 2008 in Windows XP. The dll shows up in the Project Explorer. But I can not add it to the toolbox.
MMC won’t let me add .net framework 2.0 config , but it did let me add .net 1.1 framework config which seems to work the same way. (I have .net framework 3.5 sp1 installed). I easily followed instructions, but I still get “aspnethostingpermission failed”.
Thanks a Lot. Your Post saved me