requirePermission属性的目的(web.config)

时间:2021-07-04 20:21:22

What does the requirePermission attribute in the <section> element do?

元素中的requirePermission属性有什么作用?

For example:

例如:

<configuration> 
  <configSections> 
    <section name="urlrewritingnet"   
             restartOnExternalChanges="true" 
             requirePermission ="false"  
             type="UrlRewritingNet.Configuration.UrlRewriteSection, 
                   UrlRewritingNet.UrlRewriter" /> 
  </configSections> 
</configuration>

There is no mention of this attribute in the official documention. But, seems to be used in a lot of places.

在官方文件中没有提到这个属性。但是,似乎在很多地方使用。

2 个解决方案

#1


10  

The behaviour resulting from this setting is documented at http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.requirepermission.aspx.

此设置产生的行为记录在http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.requirepermission.aspx中。

#2


4  

I'm actually going to quote the documentation just in case that page disappears as part of MSDN cleanup.

我实际上将引用文档,以防该页面作为MSDN清理的一部分消失。

When RequirePermission is set to true, the GetSection methods are restricted by the trust level setting of the application. This means that methods or properties that allow access to configuration section handlers are restricted by the trust level set for the Web application. NoteNote

当RequirePermission设置为true时,GetSection方法受应用程序的信任级别设置限制。这意味着允许访问配置节处理程序的方法或属性受Web应用程序设置的信任级别的限制。 NoteNote

NOTE: Because high and full trust are the only levels that allow access to files outside the current application domain, an application can use configuration section handlers only at these trust levels.

注意:由于高信任和完全信任是允许访问当前应用程序域之外的文件的唯一级别,因此应用程序只能在这些信任级别使用配置节处理程序。

When RequirePermission is set to false, the access to the configuration data is not restricted by the application's trust level settings. NoteNote

当RequirePermission设置为false时,对配置数据的访问不受应用程序的信任级别设置的限制。 NoteNote

NOTE: The appropriate file ACL (Access Control List) permissions are still required, regardless of the RequirePermission setting. ACL permissions determine who can access the configuration file.

注意:无论RequirePermission设置如何,仍然需要相应的文件ACL(访问控制列表)权限。 ACL权限确定谁可以访问配置文件。

#1


10  

The behaviour resulting from this setting is documented at http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.requirepermission.aspx.

此设置产生的行为记录在http://msdn.microsoft.com/en-us/library/system.configuration.sectioninformation.requirepermission.aspx中。

#2


4  

I'm actually going to quote the documentation just in case that page disappears as part of MSDN cleanup.

我实际上将引用文档,以防该页面作为MSDN清理的一部分消失。

When RequirePermission is set to true, the GetSection methods are restricted by the trust level setting of the application. This means that methods or properties that allow access to configuration section handlers are restricted by the trust level set for the Web application. NoteNote

当RequirePermission设置为true时,GetSection方法受应用程序的信任级别设置限制。这意味着允许访问配置节处理程序的方法或属性受Web应用程序设置的信任级别的限制。 NoteNote

NOTE: Because high and full trust are the only levels that allow access to files outside the current application domain, an application can use configuration section handlers only at these trust levels.

注意:由于高信任和完全信任是允许访问当前应用程序域之外的文件的唯一级别,因此应用程序只能在这些信任级别使用配置节处理程序。

When RequirePermission is set to false, the access to the configuration data is not restricted by the application's trust level settings. NoteNote

当RequirePermission设置为false时,对配置数据的访问不受应用程序的信任级别设置的限制。 NoteNote

NOTE: The appropriate file ACL (Access Control List) permissions are still required, regardless of the RequirePermission setting. ACL permissions determine who can access the configuration file.

注意:无论RequirePermission设置如何,仍然需要相应的文件ACL(访问控制列表)权限。 ACL权限确定谁可以访问配置文件。