为什么 elmah.axd 重定向到 /Account/Logon?

发布于 2024-12-10 05:56:09 字数 323 浏览 0 评论 0 原文

据我所知,我已经根据 http://www.asp.net/hosting/tutorials/logging-error-details-with-elmah-cs

但是,当我尝试在浏览器中,MVC 将页面重定向到 /Account/LogOn (我的项目中不存在)。据我所知,我的项目中没有任何对此控制器或方法的引用...

有人可以解释我做错了什么吗?

As near as I can tell, I've got elmah configured properly, according to the instructions at http://www.asp.net/hosting/tutorials/logging-error-details-with-elmah-cs

However, when I try to access elmah.axd in a browser, MVC redirects page to /Account/LogOn (which doesn't exist in my projects). As far as I can tell, there aren't any references to this controller or method in my project...

Can someone explain what I'm doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我还不会笑 2024-12-17 05:56:09

这是激活表单身份验证时登录操作的标准位置。看起来您已经在全局范围内对站点的所有部分执行了此操作,这意味着用户需要经过身份验证才能访问它。您可能已经注册了全局授权过滤器,或者您只是将 elmah 配置为需要身份验证为了便于访问。

This is the standard location of the login action when you activate forms authentication. It looks that you have done this globally to all parts of the site meaning that a user needs to be authenticated in order to access it. You might have registered a global authorize filter or you have simply configured elmah to require authentication in order to be accessible.

我偏爱纯白色 2024-12-17 05:56:09

这是由于您在站点中设置的表单身份验证,该身份验证可能配置为阻止大多数页面。您需要将 elmah.axd 列入白名单(向 web.config 添加 ),或添加登录逻辑,因为无论如何该数据都不应该公开。

另外,使用nuget添加Elmah,更容易。

This is due to Forms authenticaton you have set up in your site, which is probably configured to block most pages. You need to whitelist elmah.axd (add a <location> to web.config), or add a login logic as this data shouldn't be publicly available anyway.

Also, use nuget to add Elmah, much easier.

清风无影 2024-12-17 05:56:09

发生的情况是表单身份验证导致了重定向。

有两种解决方案:

1)在 IIS 中禁用表单身份验证

2)将以下内容添加到 web.config

<system.web>
    <authentication mode="Forms">
        <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>
</system.web>

What's happening is that forms authentication is causing the redirection.

There are two solutions :

1) Disable forms authentication in IIS

Or

2) Add the following to web.config

<system.web>
    <authentication mode="Forms">
        <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>
</system.web>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文