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.

7 comments:

sunitha vishnu said...

It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
Android Training in Chennai
Ios Training in Chennai

vijay antony said...

This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.

rpa Training in Chennai

rpa Training in bangalore

rpa Training in pune

blueprism Training in Chennai

blueprism Training in bangalore

blueprism Training in pune

iot-training-in-chennai

Jeyanthi R 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.. 
Data Science with Python training in chenni
Data Science training in chennai
Data science training in velachery
Data science training in tambaram
Data Science training in anna nagar
Data Science training in chennai
Data science training in Bangalore

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

ragul ragul 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.
Devops training in velachery
Devops training in annanagar
Devops training in tambaram
DevOps online Training

param jothi 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