Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
[^]
0
down vote
favorite
asp.net website running on dotnet 2.0 through CAS Policy exception on one page and display its running on dotnet 4.0. Here is exception message

"This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information."

<a href="https://i.stack.imgur.com/LsRZs.png"></a>[<a href="https://i.stack.imgur.com/LsRZs.png" target="_blank" title="New Window">^</a>]

While the website is targeted and build on dotnetfx 2.0. Everything on local IIS is running fine. I don't know what to do.


What I have tried:

We have checked it on Local IIS and make sure that its running on dotnet framework 2.0. Every thing is working fine on Local IIS, but exception appear on live website and only on one page.
Posted
Updated 8-Feb-17 23:33pm
v3

1 solution

The error is pretty obvious - your live site is running in a .NET 4.0 AppPool.

Either change the live site to use a .NET 2.0 AppPool; or replace the obsolete calls with the .NET 4.0 equivalents; or add the configuration switch.

The link in the error message explains the second and third options:
Code Access Security Policy Compatibility and Migration[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900