ASP.NET 用于控制对 URL 资源的客户端访问。它对于用于生成请求的 HTTP 方法(GET 或 POST)是可配置的,并且可被配置为允许或拒绝访问用户组或角色组。下面的示例显示向名为 John 的用户和名为 Admins 的角色授予访问权。所有其他用户的访问被拒绝。
<authorization>
<allow users="[email protected]" />
<allow roles="Admins" />
<deny users="*" />
</authorization>允许的授权指令元素为 allow 或 deny。每个 allow 或 deny 元素都必须包含 user 或 role 属性。通过提供一个逗号分隔的列表,可在单个元素中指定多个用户或角色。
<allow users="John,Mary" />可以使用 Verb 属性指示 HTTP 方法:
<allow VERB="POST" users="John,Mary" />
<deny VERB="POST" users="*" />
<allow VERB="GET" users="*" />
<authorization>
<allow users="[email protected]" />
<allow roles="Admins" />
<deny users="*" />
</authorization>允许的授权指令元素为 allow 或 deny。每个 allow 或 deny 元素都必须包含 user 或 role 属性。通过提供一个逗号分隔的列表,可在单个元素中指定多个用户或角色。
<allow users="John,Mary" />可以使用 Verb 属性指示 HTTP 方法:
<allow VERB="POST" users="John,Mary" />
<deny VERB="POST" users="*" />
<allow VERB="GET" users="*" />
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货