By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,564 Members | 1,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,564 IT Pros & Developers. It's quick & easy.

Path Too Long Exception being thrown before HTTPHandler gets request

P: n/a

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.CheckSuspiciousPhysical Path(String
physicalPath) +19

System.Web.Configuration.HttpConfigurationSystem.C omposeConfig(String
reqPath, IHttpMapPath configmap) +175
System.Web.HttpContext.GetCompleteConfigRecord(Str ing 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(Excepti on e, Boolean
canThrow) +39
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest 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?
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
this was a security fix added with sp1 to prevent buffer overflow errors.

http://support.microsoft.com/?kbid=886903
-- bruce (sqlwork.com)

"Seth" <a@b.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

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.CheckSuspiciousPhysical Path(String
physicalPath) +19

System.Web.Configuration.HttpConfigurationSystem.C omposeConfig(String
reqPath, IHttpMapPath configmap) +175
System.Web.HttpContext.GetCompleteConfigRecord(Str ing 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(Excepti on e, Boolean
canThrow) +39
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest 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?

Nov 19 '05 #2

P: n/a

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 Barker wrote:
this was a security fix added with sp1 to prevent buffer overflow errors.

http://support.microsoft.com/?kbid=886903
-- bruce (sqlwork.com)

"Seth" <a@b.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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.CheckSuspiciousPhysical Path(String
physicalPath) +19

System.Web.Configuration.HttpConfigurationSystem .ComposeConfig(String
reqPath, IHttpMapPath configmap) +175
System.Web.HttpContext.GetCompleteConfigRecord(Str ing 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(Excepti on e, Boolean
canThrow) +39
System.Web.HttpRuntime.FinishRequest(HttpWorkerReq uest 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?


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.