【问题标题】:ELMAH: ASP.NET securityELMAH:ASP.NET 安全性
【发布时间】:2010-11-08 12:40:52
【问题描述】:

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

v3/elmah/

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

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

顺便说一句,这是 XP SP3。

谢谢大家!

【问题讨论】:

    标签: asp.net security elmah


    【解决方案1】:

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

    更新以避免 cmets 混乱:

    在我的 web.config 中,我使用如下内容:

    <authentication mode="Forms">
        <forms loginUrl="Users/SignIn" 
               timeout="30"
               .. moreStuffHere />
    </authentication>
    

    【讨论】:

    • 你好!我已经尝试了上面的代码,并且收到“访问被拒绝”消息。但是,我没有收到用户名/密码提示。
    • 当您说提示时,我认为您的意思是像广告提示一样。您的 中有什么内容?
    • 整个网站是这样的:
    猜你喜欢
    • 2014-09-13
    • 2010-09-30
    • 2017-04-29
    • 2011-04-21
    • 2012-10-30
    • 2023-03-12
    • 2010-10-19
    • 2017-08-09
    相关资源
    最近更新 更多