我有一个使用 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/