Thursday, February 12, 2015

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

Recently when I was debugging my application I got the error “Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Below is the exact error I have received.

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.

image
I was very mush sure that I have proper permission in my system and also I am running Visual Studio in Administrator mode. So there is no way I should get security exception.

First thing I checked was the TRUST level in web.config but found that it was set to FullTrust. They suddenly I realized that I am running the code from remote share, I mean from the network drive.Therefore, the remote share that holds the Web applications content requires FullTrust.

There are two ways to solve this error,

1. Copy the complete code in your local drive and run, since you are an administrator to your system there won’t be any issues.

2. Provide FullTrust to your network drive. To provide FullTrust to your network drive you have to follow certain steps. This steps are already documented in Microsoft KB article. I would like you to go through this steps in case if you are interested to provide FullTrust to your network drive.

I hope you are able to resolve this issue now and you are able to debug your application without any problem.

Thanks for reading my article. Please rate the article by clicking on the buttons below.

6 comments:

afiah b said...

This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 
java training in omr | oracle training in chennai

java training in annanagar | java training in chennai

Unknown said...

We are a group of volunteers and starting a new initiative in a community. Your blog provided us valuable information to work on.You have done a marvellous job!

Blueprism training in tambaram

Blueprism training in annanagar

cathryn leno said...

Really great post, I simply unearthed your site and needed to say that I have truly appreciated perusing your blog entries.
angularjs-Training in chennai

angularjs Training in chennai

angularjs-Training in tambaram

angularjs-Training in sholinganallur

angularjs-Training in velachery

angularjs Training in bangalore

jvimala said...

I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
Linux Training in Chennai
Python Training in Chennai
Data Science Training in Chennai
RPA Training in Chennai
Devops Training in Chennai

Rathinam said...



This blog is very fantastic! Its much more useful information to me and Thank you for your wonderful post. Please posting...
Excel Training in Chennai
Advanced Excel Training in Chennai
corporate training in chennai
Tableau Training in Chennai
Oracle Training in Chennai
Primavera Training in Chennai
Power BI Training in Chennai
Excel Training in Chennai
Advanced Excel Training in Chennai


Ajish said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
blue prism Training in Electronic City