asp.net - ELMAH:ASP.NET 安全

标签 asp.net security elmah

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

v3/elmah/

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








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

顺便说一句,这是 XP SP3。

谢谢大家!

最佳答案

您是否在 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>

关于asp.net - ELMAH:ASP.NET 安全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1089342/

相关文章:

c# - 将 Azure Blob 容器中的 file.bacpac 导入到 Azure SQL 数据库

c - 保护或加密来自 C 程序的输入/输出?

security - 将外部用户放在 Active Directory 中是一种不好的做法吗?

asp.net-mvc - 如何让 ELMAH 与 ASP.NET MVC [HandleError] 属性一起使用?

.net - 帮助 ASP.NET 中的 Elmah 配置

ASP.NET 2.0 和 4.0 在表单例份验证中似乎以不同方式处理根 url

ASP.Net Web 表单友好 URL 在服务器上不起作用

asp.net - Active Directory LDS 异常

javascript - JavaScript 日期对象

asp.net - ELMAH 记录了两次 Ajax 错误