Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an ASP.NET site on IIS8, but IIS7.5 behaves exactly the same. When I enter a URL like:

mysite.com/foo/bar..

I get the following error with a '500 Internal Server Error' status code:

enter image description here

even though I have custom error pages set up for 500 and 404 and I don't see anything wrong with my custom error page.

In my web.config system.web node I have the following:

<customErrors mode="On">
  <error statusCode="404" redirect="/404.aspx" />
</customErrors>

If I remove that section, I get a 404.0 response back but the page itself is blank.

In web.config system.webServer I have:

<httpErrors errorMode="DetailedLocalOnly">
  <remove statusCode="404" subStatusCode="-1" />
  <error statusCode="404" prefixLanguageFilePath="" path="404.html" responseMode="File" />
</httpErrors>

But whether that is there or not, I get the same blank 404.0 page rather than my expected custom error page, or at least an internal IIS message.

So first of all why is the asp.net handler picking up a request for '..' (also works with one or more trailing dots)

If I remove the following handler from applicacationHost.config:

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />

I get my expected custom 404 page, but of course removing that handler breaks routing in asp.net among other things.

Looking at the failure trace I see:

enter image description here

Windows Authentication is disabled for the site, so why is that module even in the request pipeline?

For now my fix is to use the URL Rewrite module with the following rule:

<rewrite>
    <rules>
        <rule name="Trailing Dots" stopProcessing="true">
            <match url="\.+$" />
            <action type="Rewrite" url="/404.html" appendQueryString="false" />
        </rule>
    </rules>
</rewrite> 

This works okay, but I wonder why IIS/ASP.NET behaves this way?

share|improve this question

1 Answer 1

There is a KB about this: http://support.microsoft.com/kb/2520479

The upshot of it is that there is an order-of-operations issue where the .NET handlers for various functions get mixed up and misdirect things. Some of the .NET handlers re-write the URL to an extension-less form and they can freak out other things.

The short workaround fix is to move all the "ExtensionlessUrlHandler" handlers to the very end of the list, after any custom ones you have added that might touch the PathInfo data.

It may not be your exact error but it is well worth trying. And worth remembering that the handler order is configured by the ADD order in ApplicationHost.Config and related config files!

share|improve this answer
    
Thanks Mark, I didn't know about that article, however because I think I submitted the bug-report which lead to that article I already have my ExtensionlessUrlHandlers at the bottom of the list. –  Peter Hahndorf Dec 11 '12 at 8:11
    
Well, then both sorry and congrats. :-/ To go further with this, you might have to post a bit more about what you are doing in the 404.aspx page. Or maybe it isn't your site config that is the issue but the config that controls the 404 stuff. If your 404 page gets .NET involved in handling the PathInfo maybe a second round of modules load and freak-out on the URL then. You got a tricky one! –  Mark Dec 11 '12 at 13:45
    
I removed my 404.aspx from the customErrors, that caused the 500 error I mentioned first. I'm okay with not having it and just to use a static 404.html set in httpErrors. So now I have a 404 which is much better than the 500, but I still get the empty page and not my custom static 404 page. It would be good to know if something I did to my server or site cases this empty page or whether it is a general problem with asp.net on IIS and trailing dots in the URL. –  Peter Hahndorf Dec 11 '12 at 14:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.