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