How to increase the max length of url?

前端 未结 3 1090
伪装坚强ぢ
伪装坚强ぢ 2021-01-12 19:20

What are the best practices that I can follow to increase the max length of the URL in IIS7/ASP.NET?

Please advise.

相关标签:
3条回答
  • 2021-01-12 19:33

    Although the specification of the HTTP protocol does not specify any maximum length, the practical limit is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. These are the restrictions currently enforced by Microsoft Interet Explorer, which is still used by a sizeable majority of all users. A reasonable upper limit on the length of URLs has always been imposed by major web browsers. When you wish to submit a form containing many fields, which would otherwise produce a very long URL, the standard solution is to use the POST method rather than the GET method:

    <form action="myscript.php" method="POST">
    ...
    </form>
    

    The form fields are then transmitted as part of the HTTP transaction header, not as part of the URL.

    0 讨论(0)
  • 2021-01-12 19:51

    From this site: http://technet.microsoft.com/en-us/library/cc754791(v=ws.10).aspx

    Use command line : appcmd set config /section:requestfiltering/requestlimits.maxurl: unit

    Here is explained how to use appcmd: http://www.windowsnetworking.com/articles_tutorials/Configuring-IIS-7-command-line-Appcmdexe-Part1.html

    You need to know where the AppCmd.exe command is located as it is not in the default PATH. In order to run AppCmd.exe, you will either need to change directory into %windir%\system32\inetsrv\ or add that directory to your PATH variable. On my Windows 2008 server with a default installation, AppCmd.exe was located in C:\Windows\System32\inetsrv.

    But be careful. If your request url became realy realy large, use post message to pass parameters

    0 讨论(0)
  • 2021-01-12 19:51

    You may be limited by the following setting in web.config:

    <configuration>
       <system.webServer>
          <security>
             <requestFiltering>
                <requestLimits>
                </requestLimits>
             </requestFiltering>
          </security>
       </system.webServer>
    </configuration>
    

    Refer to: http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits#005

    0 讨论(0)
提交回复
热议问题