Path Too Long Exception being thrown before HTTPHandler gets request

S

Seth

Ok, here is my setup. I have a fully functioning HTTP Handler
implemented. The handler is supposed to handle every single request
that comes in to a particular virtual directory. Thus, in IIS, I have a
mapping of .* to the aspnet_isapi.dll. And my web.config has an entry
thusly:

<add verb="*" path="*" type="HandlerClass, HandlerAssembly" />

And this is working just fine thus far. The handler gets all the
requests and works like a champ. The requests coming in usually have
the format like:

http://localhost/Handler/4737651658416573246119

And since we are capturing everything irregardless of the filenames or
extensions or whatever, that finds its way to the handler.

And now my problem. We hit a snag today during testing where
apparently, the string of numbers after http://localhost/Handler/ was
too long. We are getting this exception:

-----------------------------------------------------------------------

The path is too long after being fully qualified. Make sure path is less
than 260 characters.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too long
after being fully qualified. Make sure path is less than 260 characters.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[PathTooLongException: The path is too long after being fully qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[]
invalidPathChars, Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator, Char volumeSeparator, Boolean fullCheck, String&
newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.Path.GetFullPath(String path) +19
System.Web.HttpApplication.CheckSuspiciousPhysicalPath(String
physicalPath) +19

System.Web.Configuration.HttpConfigurationSystem.ComposeConfig(String
reqPath, IHttpMapPath configmap) +175
System.Web.HttpContext.GetCompleteConfigRecord(String reqpath,
IHttpMapPath configmap) +434
System.Web.HttpContext.GetCompleteConfig() +49
System.Web.HttpContext.GetConfig(String name) +195
System.Web.CustomErrors.GetSettings(HttpContext context, Boolean
canThrow) +20
System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean
canThrow) +39
System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr,
HttpContext context, Exception e) +486

---------------------------------------------------------------------

And I know for a fact that I am not throwing this exception. I have the
1st line of my ProcessRequest function breakpointed, and I am not
hitting my breakpoint when this exception is thrown. Somewhere in the
bowels of ASP.net, it is being thrown. If I shorten the string of
numbers in the URL, it works. But that isn't a viable solution.

Finally, my question. Is there anyway to force ASP.net to ignore the
length of the URL?
 
B

Bruce Barker

this was a security fix added with sp1 to prevent buffer overflow errors.

http://support.microsoft.com/?kbid=886903


-- bruce (sqlwork.com)



Seth said:
Ok, here is my setup. I have a fully functioning HTTP Handler
implemented. The handler is supposed to handle every single request that
comes in to a particular virtual directory. Thus, in IIS, I have a
mapping of .* to the aspnet_isapi.dll. And my web.config has an entry
thusly:

<add verb="*" path="*" type="HandlerClass, HandlerAssembly" />

And this is working just fine thus far. The handler gets all the requests
and works like a champ. The requests coming in usually have the format
like:

http://localhost/Handler/4737651658416573246119

And since we are capturing everything irregardless of the filenames or
extensions or whatever, that finds its way to the handler.

And now my problem. We hit a snag today during testing where apparently,
the string of numbers after http://localhost/Handler/ was too long. We
are getting this exception:

-----------------------------------------------------------------------

The path is too long after being fully qualified. Make sure path is less
than 260 characters.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too long
after being fully qualified. Make sure path is less than 260 characters.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[PathTooLongException: The path is too long after being fully qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[] invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator, Char volumeSeparator, Boolean fullCheck, String&
newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.Path.GetFullPath(String path) +19
System.Web.HttpApplication.CheckSuspiciousPhysicalPath(String
physicalPath) +19

System.Web.Configuration.HttpConfigurationSystem.ComposeConfig(String
reqPath, IHttpMapPath configmap) +175
System.Web.HttpContext.GetCompleteConfigRecord(String reqpath,
IHttpMapPath configmap) +434
System.Web.HttpContext.GetCompleteConfig() +49
System.Web.HttpContext.GetConfig(String name) +195
System.Web.CustomErrors.GetSettings(HttpContext context, Boolean
canThrow) +20
System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean
canThrow) +39
System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext
context, Exception e) +486

---------------------------------------------------------------------

And I know for a fact that I am not throwing this exception. I have the
1st line of my ProcessRequest function breakpointed, and I am not hitting
my breakpoint when this exception is thrown. Somewhere in the bowels of
ASP.net, it is being thrown. If I shorten the string of numbers in the
URL, it works. But that isn't a viable solution.

Finally, my question. Is there anyway to force ASP.net to ignore the
length of the URL?
 
S

Seth

Well, I'm guessing that answers my question. If Microsoft changed how
ASP.net handled long URLs via a security patch, chances are there is no
good way to get it to ignore the long URLs. Uninstalling the security
patch isn't really an option.

So if anyone else is interested, our current (although unsatisfactory)
solution is to turn our long string of number into a query string
instead of a path. Thus,

http://localhost/Handler/4737651658416573246119

turns into:

http://localhost/Handler/?4737651658416573246119

Apparently, there are no length limitations on the query string.

Thanks for the link Bruce.

Bruce said:
this was a security fix added with sp1 to prevent buffer overflow errors.

http://support.microsoft.com/?kbid=886903


-- bruce (sqlwork.com)



Ok, here is my setup. I have a fully functioning HTTP Handler
implemented. The handler is supposed to handle every single request that
comes in to a particular virtual directory. Thus, in IIS, I have a
mapping of .* to the aspnet_isapi.dll. And my web.config has an entry
thusly:

<add verb="*" path="*" type="HandlerClass, HandlerAssembly" />

And this is working just fine thus far. The handler gets all the requests
and works like a champ. The requests coming in usually have the format
like:

http://localhost/Handler/4737651658416573246119

And since we are capturing everything irregardless of the filenames or
extensions or whatever, that finds its way to the handler.

And now my problem. We hit a snag today during testing where apparently,
the string of numbers after http://localhost/Handler/ was too long. We
are getting this exception:

-----------------------------------------------------------------------

The path is too long after being fully qualified. Make sure path is less
than 260 characters.

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.IO.PathTooLongException: The path is too long
after being fully qualified. Make sure path is less than 260 characters.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[PathTooLongException: The path is too long after being fully qualified.
Make sure path is less than 260 characters.]
System.IO.Path.nGetFullPathHelper(String path, Char[] invalidPathChars,
Char[] whitespaceChars, Char directorySeparator, Char
altDirectorySeparator, Char volumeSeparator, Boolean fullCheck, String&
newPath) +0
System.IO.Path.GetFullPathInternal(String path) +165
System.IO.Path.GetFullPath(String path) +19
System.Web.HttpApplication.CheckSuspiciousPhysicalPath(String
physicalPath) +19

System.Web.Configuration.HttpConfigurationSystem.ComposeConfig(String
reqPath, IHttpMapPath configmap) +175
System.Web.HttpContext.GetCompleteConfigRecord(String reqpath,
IHttpMapPath configmap) +434
System.Web.HttpContext.GetCompleteConfig() +49
System.Web.HttpContext.GetConfig(String name) +195
System.Web.CustomErrors.GetSettings(HttpContext context, Boolean
canThrow) +20
System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean
canThrow) +39
System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext
context, Exception e) +486

---------------------------------------------------------------------

And I know for a fact that I am not throwing this exception. I have the
1st line of my ProcessRequest function breakpointed, and I am not hitting
my breakpoint when this exception is thrown. Somewhere in the bowels of
ASP.net, it is being thrown. If I shorten the string of numbers in the
URL, it works. But that isn't a viable solution.

Finally, my question. Is there anyway to force ASP.net to ignore the
length of the URL?
 
Joined
Jan 2, 2011
Messages
1
Reaction score
0
i also have faced the same problme and

following software sort out my problem


:ciao: longPathTool.com

some of the features of this softwares are:

Path too long.
Error cannot delete file: cannot read from

source file or disk.
Cannot delete file: Access is denied.
There has been a sharing violation.
Cannot delete file or folder The file name

you specified is not valid or too long.
Specify a different file name.
The source or destination file may be in

use.
The file is in use by another program or

user.
Error Deleting File or Folder
Make sure the disk is not full or

write-protected and that the file is not

currently in use.
Path too deep.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top