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've setup custom errors for all non .NET pages using the IIS error pages module and those work fine.

i have added the tag to the web.config file for all the .net application folders. this should handle any error that is encountered when a user tries to open a .net (.aspx) page within that folder. It seems simple to setup, and it was working when i first set it up. Now, after a server reboot, it won't work anymore.

The web.config file is:

i have also tried a hard-coded path in the web.config.


The folder is setup as a .net application folder with the application pool = ASP.NET v4.0

I can browse directly to the error.aspx and 404.aspx files and open them successfully from the browser window.

www.mydomain.com/testingDotNet/404.aspx and www.mydomain.com/testingDotNet/error.aspx will load fine with no errors.

But when I try to open a non-existent page:

www.mydomain.com//testingDotNet/nopage.aspx ==> this should call 404.aspx but instead i get the .net 404 page:

The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /testingDotNet/nopage.aspx

I ran a failed request trace, but i can't really decipher anything from that. The results, with code section just before error display are: Failure Reason STATUS_CODE Trigger Status 404 Final Status 404 131. NOTIFY_MODULE_START

ModuleName="CustomErrorModule", Notification="SEND_RESPONSE", fIsPostNotification="false", fIsCompletion="false"

19:30:02.278

132. GENERAL_NOT_SEND_CUSTOM_ERROR

Reason="SETSTATUS_TRYSKIP"

19:30:02.278

133. NOTIFY_MODULE_END

ModuleName="CustomErrorModule", Notification="SEND_RESPONSE", fIsPostNotificationEvent="false", NotificationStatus="NOTIFICATION_CONTINUE"

19:30:02.278

134. i HTTPSYS_CACHEABLE

HttpsysCacheable="false", Reason="NO_PIPELINE_ENABLE", CachePolicy="NO_CACHE", TimeToLive="0"

19:30:02.278

135. i GENERAL_FLUSH_RESPONSE_START
19:30:02.278 136. i GENERAL_RESPONSE_HEADERS

Headers="Cache-Control: private Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET "

19:30:02.278

137. GENERAL_RESPONSE_ENTITY_BUFFER

Buffer=" The resource cannot be found.

I get this same response page whether i make a call to the page remotely or on the server itself. i would expect the custom page to show up on the call from a remote machine, since the customerror mode is set to "RemoteOnly". But the behavior does not change, even if i turn mode to"Off".

this seems like a pretty simple task. and oddly, it worked when i first configured it, and now it won't work. i've stopped and restarted IIS, and restarted the server. it's making me think i'm crazy! any help on why this may be happening is appreciated.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I've found over time that everything the custom errors don't work, it's almost always because something else in the web.config file is off. The troubleshoot, try a bare bones web.config with the customErrors set. That may do it. Then start adding parts of your web.config back until you get it working. Watch for inheritance conflicts between the root and subfolders too.

share|improve this answer
    
Thanks! It seems I had two problems: First was mixing absolute and relative paths in the <customerrors> section of the web config. I stripped everything but customerrors tag and one <error> tag for 404. Set all paths from the root using /foldername/404.aspx. Second problem was setting response.statuscode in the body of the error page. it was hitting the 404.aspx page, then setting the response, then redirecting to the global error page. I set the customerrors attribute redirectMode="ResponseRewrite" and moved the response.write after the close <html> in 404.aspx. Life is good! –  itrickski Apr 12 '11 at 14:20
    
Excellent, glad you tracked it down and have it working now. Thanks for the update. –  Scott Forsyth - MVP Apr 12 '11 at 14:33

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.