【发布时间】:2017-09-28 05:56:26
【问题描述】:
我创建了新项目 > ASP.NET Web 应用程序(使用个人用户帐户)。到 root web.config 我添加了`
<authentication mode="Forms">
<forms loginUrl="log.aspx" defaultUrl="about.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>`
为了将每个未通过身份验证的用户重定向到 log.aspx(它存在于项目根目录中)。但是当我现在运行我的项目时,我得到了错误
HTTP 错误 404.15 - 未找到
请求过滤模块被配置为拒绝一个请求 查询字符串太长。
Requested URL http://localhost:55371/Account/Login?ReturnUrl=%2FAccount%2FLogin%3FReturnUrl%3D%252FAccount%252FLogin%253FReturnUrl%253D%25252FAccount%25252FLogin%25253FReturnUrl%25253D%2525252FAccount%2525252FLogin%2525253FReturnUrl%2525253D%252525252FAccount%252525252FLogin%252525253FReturnUrl%252525253D%25252525252FAccount%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252FAccount%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252FAccount%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252FAccount%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252FAccount%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252FAccount%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252FAccount%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252FAccount%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252FAccount%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252FAccount%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252FAccount%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252FAccount%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252FAccount%25252525252525252525252525252525252FLogin%25252525252525252525252525252525253FReturnUrl%25252525252525252525252525252525253D%2525252525252525252525252525252525252FAccount%2525252525252525252525252525252525252FLogin%2525252525252525252525252525252525253FReturnUrl%2525252525252525252525252525252525253D%252525252525252525252525252525252525252FAbout.aspx物理路径 D:\Visual Studio 工作场所\WebApplication4\WebApplication4\Account\Login
建议的解决方法是更改 maxquerystring,所以我将其设置为 here。然后错误改变了
异常详细信息:System.Web.HttpException:此请求的查询字符串长度超过了配置的 maxQueryStringLength 值。
对我来说,这看起来像是一个无限循环。你能告诉我为什么第一个错误提到 /account/login 这是这个项目的默认设置吗?在这种情况下还有什么解决方案?
我正在使用 VS2015 和 IIS Express。
【问题讨论】:
-
看起来主要问题是查询字符串的长度。要启动 RCA,您可以增加最大长度 - stackoverflow.com/questions/11636386/…
-
听起来您已经启用了 Asp.Net Identity,但您正在尝试使用旧式表单身份验证。如果我是对的,您需要将这些东西从您的配置中删除,并对 Asp.Net Identity 进行一些研究。它的使用方式非常不同。
-
@Crowcoder 我的信息绝对可能的来源是 ISBN:978-1-4302-2529-4,它是较旧的。我想我必须创建没有身份验证的新项目,或者找出如何使用基于身份的新方法。 to:Atanu 正如我在帖子中所写的那样,我已经厌倦了它,这与您提到的问题不同,并且该线程中给出的任何答案都没有解决(到目前为止我已经厌倦了)。
-
强烈推荐Identity,值得努力学习。