ELMAH: ASP.NET安全

4
我有一个使用Visual Studio Development Server的ASP.NET 3.5应用程序。我已经设置好了ELMAH,并且它很正常地工作着。我将AXD“文件”和XML文件(使用XML作为存储介质)设置在根目录下的一个文件夹中:

v3/elmah/

现在,当请求elmah或elmah/elmah.axd(或此目录中的任何内容)时,我希望呈现一个用户名/密码对话框。目前,我在web.config中有以下设置:

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

顺便说一句,这是XP SP3。

谢谢大家!

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>

嗨!我尝试了上面的代码,但是我收到了“访问被拒绝”的消息。然而,我没有得到用户名/密码提示。 - StephenPAdams
当你说提示时,我认为你的意思是像AD提示一样。你的<authentication mode="ModeType"></authentication>中有什么? - blu
1
对于整个网站而言,它是这样的:<authentication mode="Windows"/> - StephenPAdams

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接