CAS Policy error in ASP.NET web Application

走远了吗. 提交于 2020-03-18 06:51:09

问题


I am using Devexpress controls in my WEb forms.I added the corresponding reference to my refrences folder while on adding the control (I am using grid here) gives me error

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.

I checked the solutions

and changed my web config as given in the link

However I get the same error I am using VS 2010 and my .NET framework is 4 also I am running 32 bit OS XP

Please Help


回答1:


Well I had this error earlier I solved it by changing my devenv.exe config file which is located at

[C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE][1](If your Installation directory is C:)

What you need to do is add

     <runtime>
  <NetFx40_LegacySecurityPolicy enabled="true"/>
     </runtime>

Between your Configuration tags...By this you would be able to resolve your problem But this gives rise to another problem...I had a dataset in another project which I could not inspect using Dataset Visualizer .The error I had was could not load this custom viewer.After hours of google search I found this Link1 and Link2

Another solution I tried was changing to webconfig file .I added this configuration and it was working in run time although I still get this error in design time.




回答2:


Perhaps a little late, but you can add the following to your web.config and it should work:

<system.web>
  ...
  <trust legacyCasModel="true" />
  ...
</system.web>



回答3:


I solved it by allowing full control to users in security permissions of file after closing Visual Studio 2012. File name is devenv.exe.config in the following path:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

Then open above file in notepad and add following line after <runtime> tag

<NetFx40_LegacySecurityPolicy enabled="true"/>

save the file and start using Visual Studio 2012 with design view. and now my error was gone.



来源:https://stackoverflow.com/questions/15804383/cas-policy-error-in-asp-net-web-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!