开发者

How would I use the SecurityPermissionAttribute correctly?

开发者 https://www.devze.com 2022-12-20 12:41 出处:网络
In an old project I came across 开发者_StackOverflow中文版the following assembly attribute: [assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum, Execution = true)]

In an old project I came across 开发者_StackOverflow中文版the following assembly attribute:

[assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum, Execution = true)]

I understand that this attribute instructs the clr to not load this dll if the required permissions aren't available. Is it a good practice to include such declarations in your project as a default?


RequestMinimum has never been very popular. In fact, most of the Code Access Security model never really gained much traction. Consequently, these areas were greatly reworked for .NET 4.0.

As of .NET 4.0, do not use RequestMinimum because it will be ignored.

These changes are explained in detail in the documentation for .NET 4.0, http://msdn.microsoft.com/en-us/library/dd233103(VS.100).aspx.

0

精彩评论

暂无评论...
验证码 换一张
取 消