Using the .NET Framework security system

不问归期 提交于 2019-12-04 12:46:31

The .NET code access security is more relevant when users run code directly off a server over the internet, in which case they can't necessarily trust it to automatically do things such as access the file system. I don't know of anyone who makes their code available like that, though.

I make lots of use of PrincipalPermissionAttribute to demand the user has necessary access rights (using roles) from the Thread's Principal - saves a lot of manual checking in my business code (obviously the UI should check too and disable buttons etc - this is just the double-check at the back-end).

I find Principal-based security to be very versatily, especially with a custom Principal. But I don't use the CAS stuff.

If you deploy your desktop applications with ClickOnce, then the security sandbox can come into play.

I have never seen anyone make use of the permit, assert functionality.

I suspect a number of developers are not actually aware of the functionality.

I think it could be useful to restrict calls to dangerous functions.

Its going to depend on what you are doing but who wants to make a deployment more complex than it already is?

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