System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

I rebuilt one of my development machines recently and attempted to access a project that I had out on a network share. I continually received project messages about the project not being trusted. I remembered that I had to change something but couldn't remember what it was until I found an old note I left in Outlook. The message I would receive in Visual Studio 2005 was: ASP.NET runtime error: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

To resolve this issue, you must change your development machine .net security configuration since you are accessing items across the network. In the event that you need this ability at runtime, you must change the trust level in your config file to full. However, since this is only in development, I can change my local PC's security by going to Start > Control Panel > Administrative Tools > Microsoft .NET Framework 2.0 Configuration. After it fully loads (sometimes takes a bit), fully expand My Computer in the navigation tree and click Runtime Security Policy. In the right hand pane, choose Adjust Zone Security. Leave the default option (Make changes to this computer) and hit next. Choose Local Intranet and change the trust level to Full Trust. Then choose next and then finish. Restart Visual Studio 2005 and you should be all set.

Published Tuesday, February 13, 2007 4:39 PM by Jason N. Gaylord
Filed under:

Comments

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, February 27, 2007 9:44 AM by Ted

This was really helpful, thank you.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, March 27, 2007 4:58 PM by Mary P.

I recently made this adjustment to my machine and resolved the Permission issue described.  However, I've since had a coworker access the solution and attempt to debug.  She, of course, received the errors just as I had initially.  I made the zone adjustments to her machine as I did on mine but she's still getting the errors (4 of the same).  Any ideas?

thanks in advance for any help.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, April 05, 2007 12:38 PM by Jason N. Gaylord

Unfortunately not. Are you sure you made those adjustments in the 2.0 configuration?

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, April 16, 2007 12:27 PM by Sick

Great post! Exactly what I was looking for. Thanks, Jason.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, April 17, 2007 3:54 PM by Simon H

Great post, thanks!!  Was pulling my hair out with this one.

Cheers!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, May 03, 2007 6:35 PM by Mike

Hey mate, that's awesome, was absolutely driving me nuts this!!!!!!!!!!!! Argh!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, May 17, 2007 11:38 AM by alex riou

THANKS A LOT - MERCIIIIIIIIIIIIIIII BEAUCOUP

that's really helpfull as I was looking for the solution for a couple of hours

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, June 20, 2007 6:19 AM by Sick

This did work for 'regular' ASP.NET sites, however it does not seem to work when you add some additional assemblies such as ASP.NET Ajax (AjaxControlToolkit.dll).

Does anyone have any suggestions for this problem at devtime?

# Error 'System.Web.AspNetHostingPermission' only for AjaxControlToolkit.dll

Wednesday, June 20, 2007 8:04 AM by ASP.NET AJAX Toolkit Forum Posts

The error, as mentioned below, has been adressed many times, but this has a slight variation: Request

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, June 27, 2007 10:09 AM by Sriman

I did the adjustments in my machine(.net 2.0 configuration). But no luck .. still not working. Actually i got this error in SqlReporting services. I am trying to access the my custom dll methods from sqlreport.  Any help would be greatly appreciated.

Regards,

Sri :)

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, July 25, 2007 11:16 AM by Donald Bittenbender

I would just like to say awesoome! This fixed our remote debugging issues on a local share.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, August 16, 2007 2:38 PM by Fabricari

You rock! Several folks and I at my company thank you for this article.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, August 20, 2007 1:18 PM by Kris

Thanks for this reminder...

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, September 11, 2007 8:37 AM by LCR

This solved my problem!!  

U truly rock!!!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, September 17, 2007 3:07 PM by Indy

Cool. This posting solved my problem.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, September 20, 2007 3:31 AM by Paul

I have been having this issue trying to access SQL Server Reporting Services via the Plumtree Portal, still no luck!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, September 20, 2007 3:34 AM by Paul

I have been having this issue trying to access SQL Server Reporting Services via the Plumtree Portal, still no luck!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, October 10, 2007 11:55 AM by Claudio

Thanks!! very useful

# Another "Element 'xxxx' is not a known element" question

Friday, November 02, 2007 2:36 PM by ASP.NET AJAX Toolkit Forum Posts

I have a newly rebuilt machine with VS 2005 SP1 and connect to a development web site by file path, file

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, November 06, 2007 2:59 AM by Niklas

Thank you! I was going nuts over this thing.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, November 26, 2007 2:33 PM by Jason

Thanks!!!!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, November 29, 2007 10:40 AM by Bruno

I had the same problem and your tip helped me. Thank you ;-)

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, December 04, 2007 8:55 AM by Wallace

Thanks...got it fixed after a couple of tries..first changed the 1.0 before I reread the instructions and got to the 2.0 configuration...great help.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, December 07, 2007 2:26 PM by James

Awesome! - did the trick for me as well.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, February 01, 2008 9:54 AM by Lee

Outstanding!  This was quite helpful.  Great tip.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, February 20, 2008 3:56 PM by Lyle

THANK YOU VERY MUCH. SAVED ME ALOT OF TIME.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, March 10, 2008 2:35 PM by Eduardo

TKSSSSSSSSSSSSSSS Man !!!

You save me life with this information !!!!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, March 20, 2008 4:29 PM by mike

Thanks a lot.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, March 24, 2008 8:31 AM by Ed

I am receiceing the error with a Web Control library protect.  The control causes the error on my company intranet but works just fine on my local machine.  Any Ideas of this?

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, April 23, 2008 11:49 AM by Jason

This tip lead me in the right direction. I tried adjusting the zone security as described above, but that did not work. I ended up using "Increase Assembly Trust" from the runtime security screen and this worked.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, May 02, 2008 4:49 PM by C Flaherty

This worked for me.  thanks.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, May 07, 2008 2:29 PM by Anna

Can't thank you enough for this one -- I've spent hours looking through IIS and machine.config to figure this out. I ALMOST didn't try this because it seemed too simple, but I was desperate! :-) It solved my problem!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, May 29, 2008 3:43 PM by VIJAI

Your solution also worked for me when I was struggling to load the Ajaxcontrol extenders. It didn't let me do it because of trust issues. I followed the steps and bang the controls got loaded when I add the dll.. Thanks.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, July 29, 2008 5:15 PM by John

Worked perfectly for me.  Thanks.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, August 05, 2008 10:57 AM by pthalacker

I have the 2.0 framework installed on my local machine, but there is no configuration utility.  There is a configuration utility for 1.1, but not 2.0

pamela

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, August 07, 2008 9:49 AM by asimpson

Thank you so much.  I tend to believe that an update to the 2.0 Framework caused this headache.  Yet another one of Microsoft's well thought out mysteries.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, August 29, 2008 12:43 PM by Tracy Rojas

Thanks!  You're post continues to be helpful! :)

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, August 29, 2008 2:59 PM by D_S

Awesome.  Thanks.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, September 24, 2008 9:16 AM by Julian

pthalacker: I know its over a month ago, but in case you never got sorted maybe this would help: (from MS web site)

"If Microsoft .NET Framework Configuration is not displayed under Administrative Tools, you can install the .NET Framework SDK to add Microsoft .NET Framework Configuration. Alternatively, you can run the following command to make the change:

Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on

Note For more information about what these arguments do, run the following command:

caspol.exe -?"

JASON: A big thank you to you, 18 months on and the article is still proving helpful!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, October 22, 2008 10:19 AM by Petter

I sad to say I didn't get this to work. When I try to build a website trough a deployment package I get the error. Setting the security level for local intranet doesn't seem to work.

I have built the solution many times without this problem and suddenly when I made a small change another part of the solution this arises from nowhere. Anyone with a nice guess??

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, October 29, 2008 6:41 AM by James

You sir are a genius and a life saver, ta very muchly

# nateirwin.net » Blog Archive » System.Web.AspNetHostingPermission

Pingback from  nateirwin.net  » Blog Archive   » System.Web.AspNetHostingPermission

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, November 11, 2008 10:57 AM by Miguel

It worked for me, Perfect!!!

Thanks

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, November 27, 2008 8:34 AM by kinjalin

Thanks. ur a Saviour

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, December 03, 2008 12:12 PM by Joe Axe

This hint saved my day!

Thanks!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, December 11, 2008 1:20 PM by Jason LaBaw

What if your solution is hosted on Godaddy?

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, December 29, 2008 10:40 AM by Paulo Melo

This is a 5 stars tip. Thank you Jason

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, January 29, 2009 11:45 AM by swharrell

Thank you for this information. After chasing this error for three day's and numerous sources your information helped my resolve it.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, February 06, 2009 12:23 PM by Staffan

Couldn't agree more with the other folks here except I was fortunate enough to come across this post quickly in my search to resolve the problem. So much to learn.

Thanks for the help.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Tuesday, February 17, 2009 9:37 AM by gigirex

Thank you for your help from Tuesday, February 13, 2007 until today.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, March 05, 2009 2:43 PM by ajg

Thanks a lot! Fixed my problem of the day, woot.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, March 26, 2009 3:35 PM by Andre

Perfect ! Thank you so Much !

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Saturday, March 28, 2009 1:32 AM by Joannah

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

Joannah

http://2gbmemory.net

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Wednesday, May 06, 2009 6:17 PM by Ivonne Labrin

Muy util, gracias!

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, May 15, 2009 3:24 PM by Kreshiv Madhan

Great idea.. thanks for solving my issue.

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, May 28, 2009 4:51 PM by Dhruv21

Great ! Exactly what I needed.

# System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005 « Vardars Blog

Pingback from  System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005  « Vardars Blog

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, June 12, 2009 4:03 AM by Farzad

I have .net 3.5 and Visual Studio 2008

But I haven't something like Microsoft .NET Framework 2.0  or Microsoft .NET Framework 3.5 in Administrative Tools .

Is there any solutio for Visual studio 2008 ?

Thanks  in advance

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Friday, July 10, 2009 3:46 PM by Tagger

You sir, are my hero... :D

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Thursday, August 27, 2009 11:21 AM by Shar

This was very very helpful. Thanks a lot. I did not know how to change the security level to high trust. This was very helpful

# re: System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005

Monday, September 21, 2009 1:14 PM by Rocco

Thanks a lot, it helps me so much

Leave a Comment

(required) 
(required) 
(optional)
(required)