.NETGURU
ASP.Net and CustomError Handling
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Paul (VIP)
I have written a custom dll that I put inside the /bin directory of a
production IIS server. Inside the config file of the web application i have
added the following setting:

<httpModules>
<add name="ExceptionManagerHTTPModule"
type="Digiscribe.HTTPModule.ExceptionManagerHTTPModule, HTTPModule" />
</httpModules>

In this dll I have inherited from the IHttpModule which in turn has given me
the ability to trap unhandled exceptions and errors through out the
application. Everything is working great. If an error happens that has not
been handled then this module kicks in and does what I need it to do.
However, on all 404 errors it decides not to work and directs it to a generic
error page "The Resource cannot be found".

When I was working with this application on my local box 404 errors were
handled by my custom dll, once moved to production on a different server,
they are no longer handled. Any help in figuring this out will be greatly
appreciated. Thank you in advance.

Sincerely,
Paul ><>
Reply to this message...
 
    
Joyjit Mukherjee
Hi,

try putting a customerrors element in your web.config as follows: -

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

HTH
Regards
Joyjit

"Paul" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Frank Mamone
Hi Joyjit,

This will work, but not as intended. Paul wants his custom exception handler
to take care of the error so he can do custom stuff.

I too am curious on why this is not working.

-Frank

"Joyjit Mukherjee" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Paul (VIP)
Frank,
That is correct. The first reply will not work because if I put that in
there then my custom dll would not intercept the error and do the custom
processing that I am trying to accomplish.

If anyone else has any ideas I would love to hear them. This is a really
strange behavior that I can not reproduce on my box. Thank you all for
replying and trying to help out...

Paul ><>

"Frank Mamone" wrote:

[Original message clipped]

Reply to this message...
 
    
SevDer
I think the result is obvious.
And Joyjit's suggestion is a solution.

It doesn't work for 404 pages becuase your dll is for your web
application, however page 404 is IIS behaviour. Therefore it never
reaches your application when page is not found and as a result it
doesn't load and process your dll. If you need 404 to process your dll,
then you need to refer this in web.config custom error pages as Joyjit
suggested.

--

SevDer
http://www.sevder.com

Paul wrote:

[Original message clipped]

Reply to this message...
 
    
Frank Mamone
SevDer,

I think you're on the right track but then as stated earlier, the custom dll
will not pick it up.

Maybe you need to disable the 404 default handling in IIS.

Paul maybe you can check the Custom Error tab in IIS on your development
server and see how the 404 is set?

- Frank

"SevDer" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Paul (VIP)
Thank you all for your responses, they are really appreciated.

However here is the issue. I agree with you all and believe it is an IIS
issue however, when I run this application from my local box my custom error
dll picks up the 404 error and processes it through and then re-direts the
page to my specified CustomError.aspx page. My server does this...The
production server does not do this. As far as I can tell all the config file
setting and custom error settings on the 404 are exactly the same on both
boxes...That is why this is just a weird error.

I will try setting the custom error page in the config file, however I don't
think this is going to work. I din't have to have this setting on my box
which works like i think it should. Again thank you all for you responses, i
really appreciate them

Paul ><>

"Frank Mamone" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Web.IHttpModule




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification