gpt4 book ai didi

asp.net - ASP.NET MVC 中的 URL 长度 - 超过 260 个字符会导致错误请求 - 无效的 URL

转载 作者:行者123 更新时间:2023-12-05 01:01:42 24 4
gpt4 key购买 nike

我遇到了 URL 超过 260 个字符的问题

  • ASP.NET MVC 4.0
  • Umbraco CMS
  • Azure 网站

IIS 阻塞并引发以下错误:

Bad Request - Invalid URL

HTTP Error 400. The request URL is invalid.

Example URL:

http://example.com/article/123/some-headline-longer-than-260-characters-with-only-text-and-numbers-used

在我的例子中,URL 的长度为 303 个字符,没有任何查询字符串。将 URL 缩短为 260 个字符可以解决问题,但对我来说这不是一个可行的解决方案。由于我使用的是 ASP.NET,所以我将以下内容添加到 web.config - 但是,即使使用 maxUrlLength="1024",问题仍然存在:

<?xml version="1.0"?>
<configuration>
<system.web>
<httpRuntime
requestValidationMode="4.0"
requestPathInvalidCharacters="&lt;,&gt;"
maxUrlLength="1024"
maxQueryStringLength="768"
relaxedUrlToFileSystemMapping="true" />
</system.web>
</configuration>

附加信息:我的所有网址均保持在 2000 左右的限制以下(参见 What is the maximum length of a URL in different browsers? )

有什么想法吗?

最佳答案

您可能需要扩展注册表中的限制:http://support.microsoft.com/kb/820129

关于asp.net - ASP.NET MVC 中的 URL 长度 - 超过 260 个字符会导致错误请求 - 无效的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27870604/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com