【问题标题】:You are not authorized to view this page active directory problem您无权查看此页面活动目录问题
【发布时间】:2009-12-07 15:05:22
【问题描述】:

浏览部署在 IIS 中的 asp.net 页面时出现以下错误。我在我的网站中使用活动目录数据检索,活动目录的凭据存储在 web.config 文件中......

You are not authorized to view this page
You do not have permission to view this directory or page using the credentials that you supplied. 
--------------------------------------------------------------------------------

Please try the following:

Contact the Web site administrator if you believe you should be able to view this directory or page. 
Click the Refresh button to try again with different credentials. 
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401. 
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Authentication, Access Control, and About Custom Error Messages.

有帮助吗??

【问题讨论】:

  • 编辑您现有的问题,不要重复发布。
  • 它关闭了我需要编辑吗?

标签: .net asp.net vb.net iis


【解决方案1】:

如果您使用 Visual Studio 进行开发,请转到“网站”选项卡并单击 ASP.NET Configuration。服务器将启动,通过单击安全链接,您将能够管理对网站的访问。

这也可以在您的网络服务器上的 IIS 中完成,运行 IIS 管理器突出显示您的站点并单击 .net authrization

以上两个步骤是使用 GUI 完成的。

但是,您可以通过 web.config 文件轻松编辑整个网站的授权,或者如果您的页面保存在文件夹中,则单独编辑它们。

代码:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
          <allow roles="Admins"/>
          <deny users="*" />
        </authorization>
    </system.web>
</configuration>

在上面的代码中,Admins 是一个已在后面的代码或 ASP.NET 配置实用程序中设置的角色。如果您只需要拒绝匿名用户的访问,即。那些没有登录内网的用户你可以使用:

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

但是我不太确定上面的代码,如果切换顺序可能会禁止所有用户甚至非匿名用户。

从您的描述看来,在这种情况下,授权是按用户完成的:

<authorization>
         <allow users="DOMAIN\SAMACCONTNAME", "Company\SCOTTG"/>
         <deny users="*" />
</authorization>

【讨论】:

    【解决方案2】:

    你问这个问题已经有好几年了,但以防万一其他人正在寻找答案:

    启用 Windows 身份验证,并按照以下文章操作:

    IIS 7 Error

    【讨论】:

      【解决方案3】:

      在 IIS 6 中,右键单击您的 Web 应用程序,选择属性 > 目录选项卡 > 配置按钮 > 插入新的通配符应用程序映射并输入以下值: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-09-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-09-02
        • 2021-01-29
        • 2021-01-07
        相关资源
        最近更新 更多