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

我们在我们的应用程序中使用ELMAH错误异常记录.我希望保持ELMAH安全的一般用户,同时仍然提供给应用程序的管理员/开发人员.

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

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

看看Google带来了article on CodeProject关于如何设置身份验证通过Cookie.这是我的问题的好方法吗?

还有另一种方法能够在仍然安全的情况下能够访问RSS Feed

谢谢.

解决方法

Supporting HTTP Authentication and Forms Authentication in a Single ASP.NET Web Site

基本上你添加一个名为MAdam的dll到你的项目中调整你的web.config并配置你要验证哪个文件作为基本而不是表单:

<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>

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

旁注MAdam是由同一个写的ELMAH的家伙写的,巧合?

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....