保护ELMAH同时又使人们可以通过RSS阅读器来访问它
-
20-08-2019 - |
题
我们使用ELMAH错误异常日志记录在我们的应用程序。我想保持ELMAH从普通用户的安全,同时还使其可用于应用程序的管理员/开发人员。
当您设置安全性在web.config窗体身份验证你再失去访问RSS提要的能力。我希望能够争取到ELMAH但仍通过身份验证从一个RSS阅读器传递到AXD才能够访问RSS提要(即/elmah.axd/rss)。
以为HTTP认证将是适合作为,那么我大概可以得到与以下URL语法的 HTTP://用户名:password@somedomain.com/elmah.axd/rss 我假设你需要在web.config的具体路径上设置身份验证模式=“窗口”。一个问题弹出,虽然是你如何在一个虚拟文件中设置凭据?
看着谷歌带回这个文章在CodeProject 如何建立与饼干认证直通。这是一个很好的解决了我的问题?
有另一种方式,是更好地能够访问RSS源,同时仍然安全吗?
感谢。
解决方案
基本上你一个名为MADAM DLL添加到您的项目调整你的web.config和配置的文件(S)你想为基础的,而不是形式进行验证:
<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提要我的问题。
边注MADAM由写ELMAH同一个人写的,巧合吗?
其他提示
取决于客户端我猜 - 我知道一些桌面读写器(相信其他人做,以及)支持需要验证的饲料,并提供一个登录框,要求其在第一次 - 不知道他们在做什么在幕后,使其工作虽然
。不隶属于 StackOverflow