ASP如何获取代码中的授权规则?不是来自web.config的部分,而是实际规则

时间:2013-05-07 08:17:24

标签: asp.net iis web-config windows-integrated-auth

嗯,说实话,问题是'currentUser.Identity.Name'为空的原因。 选项包括:

`<authentication mode="Windows">
</authentication>
<identity impersonate ="false"/>`

启用IIS 7集成Windows身份验证,禁用“匿名访问”。 (有人提到here) 应用程序正在同一域中的本地计算机上执行。 当我想写作时:

<authorization>
  <allow users="MY_USER_NAME"/>
  <deny users="?"/>
</authorization>

我得到了第401.2页,禁止访问。

现在,我认为,选项来自于somwhere,并且仍然启用了“匿名访问”。那么,我需要如何检查代码中的实际值。

更新 角色管理器是这样的:

<roleManager defaultProvider="DefaultRoleProvider" enabled="true">
  <providers>
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
  </providers>
</roleManager>

解决

0 个答案:

没有答案