System.Web.AspNetHostingPermission Failed Error – .NET 2.0

by Judi Smith on June 18, 2006

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.

Similar Posts:

{ 17 comments… read them below or add one }

1 Maur0 August 1, 2006 at 10:33 am

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.

2 Matt Ray August 21, 2006 at 8:09 am

Me too!

3 Johnny B September 15, 2006 at 11:01 am

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.

4 Gavin Mannion October 3, 2006 at 2:59 am

Lovely thanks man…. Sorted

5 waqas November 21, 2006 at 7:14 am

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.

6 Koen Hoebeek February 13, 2007 at 4:57 am

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

7 G27 February 15, 2007 at 11:24 pm

This was driving me nuts trying to get CSLA working. Thanks for the solution. You rock!

8 Marc Rivers March 6, 2007 at 11:15 pm

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!

9 Johan June 20, 2007 at 3:57 am

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

10 OMARdotNET August 29, 2007 at 9:42 am

WOW…WOW…WOW….

YOU ARE THE BEST. THANK YOU SO MUCH. THAT DID IT.

WHOOOO

I’M HAPPY.

11 Ted October 14, 2007 at 11:04 am

Slam Dunk – yet another Thank You!

12 Sheena December 17, 2007 at 3:07 am

Fantastic Solution – Great it works like a charm !!!!

13 I AINT HAPPY February 6, 2008 at 4:39 pm

UHHHHHHHHHHHHHHHHHHhhhh

14 Sam March 8, 2008 at 12:03 pm

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.

15 Guts January 16, 2009 at 2:39 am

Thanks a lot, great article. It helps a lot.

16 D3bug March 27, 2009 at 4:46 am

Worked like a charm, thank you very much.

17 Don B July 7, 2009 at 5:02 pm

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”.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Next post: OS X Tiger smbd process overflow fix (error -10810)