About the maximum url length! Does. NET have a BUG? (IIS is not resolved unless the listening port mode is enabled)

Source: Internet
Author: User

Url rewrite:

Http: // 127.0.0.1/playflash/1_2_3_4 _ *****. html

Or

Http: // 127.0.0.1/playflash/1/2/3/4/5 /*****/

When the URL of this site"/Playflash/"After the length reaches 260, the following error is reported in IIS:

Bad Request (Invalid URL)

After checking GG, follow the help instructions

Http://support.microsoft.com/kb/820129

The Registry configuration of HTTP. SYS has been modified. It still becomes invalid after the service is restarted!

Then carefully read GG's documents

 

UrlSegmentMaxLength 260 0-32,766 characters The maximum number of characters in a URL path segment (between slashes in a URL. If it is zero, its length is limited by the maximum value of ULONG.

 

After setting the maximum value, it does not work under ASP. NET. It is still limited to 260!

How does one solve the length of ASP. net rewrite url?

Is the configuration of ASP. NET configured with max request url?

Then I checked GG again... It is concluded that IIS 7 can be configured ,,,

What about IIS 6 ??? No solution found... So I sent it to the homepage for help!

 

Resolved. HTTP seems to follow the windows directory structure, with a maximum path of 260 characters!

 

Windows Restrictions on long path name files

As we all know, Microsoft's file system has undergone the technological revolution of fat-> fat32-> NTFS. Regardless of Security and file organization innovation, a single file name is already in the old DOS 8.3 file format (only a file name with a maximum of 8 characters and a suffix with three characters is supported) convert to a file name that supports up to 255 characters. NTFS supports up to 32768 characters of path length.

However, in Windows, the path name length limit is not completely released. In windef. h, you can find the following macro:

#define MAX_PATH 260


In fact, all Windows APIs follow this restriction. Therefore, when we try to change the file name, when the input file name length (full path) reaches a certain limit, although the file name itself has not reached the limit of 255 characters, however, no input will be accepted. This is because the operating system does not allow the full path of a file with 260 characters (bytes.

In practical applications, this 260-character full path restriction makes it inconvenient for application development. Imagine the following application: we want to add a local cache function to the application server, which can save a local copy of the files on the remote server. A reasonable implementation can map the url into a file name. When the url is very long, the length of the cache file will also be very long. When the file name length exceeds 255, we can use the first 255 characters of the mapped file name as the directory name. However, we still cannot solve the full path limit of 260 characters. In addition, if the directory structure of an application is too deep, some file names (including paths) may contain more than 260 characters, and thus cause installation or deletion failure. All in all, this restriction makes development and testing inconvenient.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.