ASP_PNET URL MAX_PATH Limit

I discovered an issue with ASP.NET that I know at least stopped another person. We tried to use the HttpModule to process the web application request template. The generated URL is dynamic and may possibly be several hundred characters. Unfortunately, there seems to be a limitation in the aspnet_isapi.dll file, which limits the path length in the url to MAX_PATH, which is hardcoded at 260 characters.

Has anyone else come across this and found a way to overcome this limit? Query string parameters are not an option.

Thanks Greg Ballard

+10
url isapi
Nov 05 '08 at 14:20
source share
7 answers

This is a known issue with aspnet_isapi.dll and there is currently no workaround. The reason you do not see this problem when you start your site in the embedded Visual Studio web server (aka Cassini) is because all the managed code does not rely on aspnet_isapi.dll.

This will be discussed in a future version of ASP.NET.

+8
Nov 05 '08 at 17:24
source share

In the end, I decided to use the following command in web.config to solve this problem using Mvc2 and .Net Framework 4.0

<httpRuntime maxUrlLength="1000" relaxedUrlToFileSystemMapping="true" /> 
+7
Apr 7 '11 at 18:18
source share

The problem actually lies inside Windows, not ASP.NET. Windows set MAX_PATH to 260, and when IIS accepts a request for a longer file name, it will not work. You probably found this KBase article already, but for anyone else: http://support.microsoft.com/kb/q177665/ . The "Applies to:" section shows that this is the expected behavior from NT 3.51 to Vista and Server 2003.

As for the workaround, I had a similar situation, but we would give up trying to avoid the query string parameter and anyway.

+3
Nov 05 '08 at 14:42
source share

Thanks for your reply. Although I did not find this exact article, I found a similar one. However, this is not a limitation in IIS. You can pass a longer path in the request in IIS and it will return the correct answer. You can check by trying with a simple html page. The problem only occurs when using aspnet_isapi.dll to process requests. Even the integrated debug server in visual studio can handle longer paths than 260.

+2
Nov 05 '08 at 15:22
source share

@Haacked:

Phil, you mentioned that this is a problem with aspnet_isapi.dll. Does this not mean that this problem should not exist in IIS7 integrated pipeline mode?

From what I heard, however ( http://forums.iis.net/t/1105360.aspx ), he still does.

I am facing the same problem and feel that I am feeling somehow. ASP.NET routing seems to be affected. Thus, any ASP.NET MVC application should have URLs shorter than 260, after which it should return to querystrings, which looks like a full 180!

(Sorry for the answer-commenting ... not enough comments for comments :()

+2
Jul 26 '09 at 9:07
source share

The UrlSegmentMaxLength registry key can be used to increase the standard Windows maximum 260 characters per Url segment in incoming HTTP requests:

  • Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters
  • Value: UrlSegmentMaxLength
  • Type: REG_DWORD
  • Data: (Desired maximum allowable Url segment length, e.g. 4096)

The maximum allowed value is 32766. If a larger value is specified, it will be ignored. (Credit: Juan Mendes)

More details about http.sys settings: http://support.microsoft.com/kb/820129

To make changes to this parameter, a PC reboot takes effect. (Credit: David Rettenbacher, Juan Mendes)

Original source for this answer: stack overflow

+2
Feb 10 '16 at 16:11
source share

You can use ISAPI to rewrite URLs such as IIRF to rewrite the URL into something that aspnet_isapi can handle.

0
Nov 18 '08 at 16:38
source share



All Articles