保护ELMAH,同时可以通过RSS阅读器访问它

Red*_*ves 14 asp.net security elmah web-config windows-authentication

我们在应用程序中使用ELMAH错误异常日志记录.我想让ELMAH对常规用户保持安全,同时仍然可以将其提供给应用程序的管理员/开发人员.

在web.config中使用表单身份验证设置安全性时,您将无法访问RSS源.我希望能够保护ELMAH,但仍然通过身份验证到axd,以便能够从RSS阅读器访问RSS提要(即/elmah.axd/rss).

认为http身份验证是正确的,我可以使用以下url语法访问rss feed http:// username:password@somedomain.com/elmah.axd/rss我假设您需要设置身份验证模式=" windows"在web.config中的特定路径上.弹出的一个问题是如何在虚拟文件上设置凭据?

看看Google 在CodeProject上发布了关于如何使用cookie设置身份验证直通的文章.这是我的问题的一个很好的解决方案吗?

还有另一种方法可以在保持安全的同时更好地访问RSS提要吗?

谢谢.

Red*_*ves 12

在单个ASP.NET网站中支持HTTP身份验证和表单身份验证

基本上你将一个名为MADAM的dll添加到你的项目中调整你的web.config并配置你想要认证的文件为Basic而不是Forms:

<configuration>
    <configSections>
        <sectionGroup name="madam">
            <section name="userSecurityAuthority" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <section name="formsAuthenticationDisposition" type="Madam.FormsAuthenticationDispositionSectionHandler, Madam" />
        </sectionGroup>
    </configSections>

    ...

    <madam>
        <userSecurityAuthority ... />

        <formsAuthenticationDisposition>
            <discriminators all="[true|false]">
                ...
            </discriminators>
        </formsAuthenticationDisposition>
    </madam>

    ...

    <system.web>
        <httpModules>
            <add name="FormsAuthenticationDisposition" type="Madam.FormsAuthenticationDispositionModule, Madam" />
            <add name="AuthenticationModule" type="MADAM Authentication Module Type" />
    </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)

这很容易设置并解决了我能够验证elmah.axd并仍能使用基本身份验证凭据订阅RSS源的问题.

旁注MADAM是由写ELMAH的同一个人写的,巧合?