Check for Missing Page Handler


J

Joseph Geretz

I have a server application which process transactions over HTTP. The
application is constructed with the implementation of an HttpModule which
pre-processes and post-processes every transaction. The handling of each
particular transaction is delegated to a specific HttpHandler which is
defined for the particular 'page' request.

Occasionally, a server will be deployed with an incorrect config file so
that one or more transaction pages are not mapped to the correct handler.
When this happens, the transaction doesn't get processed and nothing is
returned to the client. We are aware of this 'pattern' and we can diagnose
these failures pretty quickly since the lack of any transactional response
implicitly means that no transaction handler was mapped to process the
transaction. However, I'd like to be more explicit about this so than in
such an instance a defined error can be returned to the client - No
transaction handler configured to process this transaction.

My first choice would be to have the HttpModule preprocess the transaction
to verify that a handler is mapped. Is there a way to interrogate the IIS
application environment to determine what handlers are mapped to a given
page request? This would be my first choice.

An alternate choice would be to simply read the application config file to
get this information; This would be a simple implementation, I can use XPath
to read the httpHandlers block and look for the path attribute which matches
the current page; if the element doesn't exist then the current page request
isn't mapped.

Another alternate would be if I can set up a default 'catch all' handler in
the config file which would handle any page not mapped to a specific
handler. I don't even know if this is possible though.

Thanks for any suggestions which you can provide!

- Joseph Geretz -
 
Ad

Advertisements

J

Joseph Geretz

OK, I got it - it's actually pretty simple.

Since all of our Handlers are types which start in the 'srs.' namespace, all
I need to do is handle the OnEndRequest and examine HttpContext.Handler. If
it doesn't start with 'srs.' then it's not our handler which is handling the
request and so this is cause for returning the error.

Hope someone will find this tip useful.

- Joseph Geretz -
 

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

Top