4

我有一个使用 Visual Studio 开发服务器的 ASP.NET 3.5 应用程序。我设置了 ELMAH,它工作正常。我将 AXD“文件”和 XML 文件(使用 XML 作为存储介质)设置在根目录下的文件夹中:

v3/埃尔玛/

现在,我想拥有它,以便在请求 elmah 或 elmah/elmah.axd(或此目录中的任何内容)时,会显示一个用户名/密码对话框。现在,我在 web.config 中有这个:

我相信这允许所有经过身份验证的用户。我已尝试禁用对该目录的匿名访问,但仍在提供该文件。我需要更改文件系统的安全性吗?

顺便说一句,这是 XP SP3。

谢谢大家!

4

1 回答 1

5

您是否在 web.config 中添加了类似的内容?

<location path="admin/elmah.axd">
    <system.web>
      <authorization>
        <allow roles="Admin"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>

web.config 中的 ELMAH 部分节点还有一个可用的 requirePermission 属性。

<sectionGroup name="elmah">
  <section name="security" requirePermission="true" type="Elmah.SecuritySectionHandler, Elmah" />
  <section name="errorLog" requirePermission="true" type="Elmah.ErrorLogSectionHandler, Elmah" />
  <section name="errorMail" requirePermission="true" type="Elmah.ErrorMailSectionHandler, Elmah" />
  <section name="errorFilter" requirePermission="true" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>

更新以避免评论混乱:

在我的 web.config 我使用类似的东西:

<authentication mode="Forms">
    <forms loginUrl="Users/SignIn" 
           timeout="30"
           .. moreStuffHere />
</authentication>
于 2009-07-06T21:43:38.033 回答