HttpModule preventing execution of HttpHandlers

M

MWells

I'm having an issue getting my HttpHandlers and HttpModules to play together
nicely.

My HttpHandlers take special document types (defined by extension) and
process them specially. I might have an HttpHandler installed to render
Excel files as HTML, or to render TIFFs to JPEGs, etc.

The HttpModules are used for Uri handling, so that a request for a resource
like;

http://somesite.com/file/sales_data.xls

....gets converted to something internally meaningful, like a database query
or a retrieval action from a third-party content management system.

Unfortunately with the HttpModule installed, the HttpHandlers never run; so
even with an HttpHandler registered to handle the ".xls" file type, the raw
Excel file is returned to the client rather than the HttpHandler-generated
content.

Is there something that I need to do in the HttpHandler to ensure that the
normal chain of processing continues? Or could Uri-rewriting be confusing
the situation, such that a conversion of;

http://somesite.com/file/sales_data.xls

....to...

http://somesite.com/getfile.aspx?FileID=103

....would prevent the matchup of the request to the defined HttpHandlers?

My best guess is that I'm doing something incorrectly in the HttpModule
that's gumming up the works, so to speak.

If not, I'm fine with invoking the HttpHandlers directly if needed. I
assume that I can read the Web.config file, determine which handler applies
based on the file extension, and invoke the handler... but in this approach
I'm uncertain how to mimic the webserver's call to the handler.

I'd greatly appreciate some advice on either approach.

/// Michael Wells
 
J

John Saunders

MWells said:
I'm having an issue getting my HttpHandlers and HttpModules to play
together
nicely.

My HttpHandlers take special document types (defined by extension) and
process them specially. I might have an HttpHandler installed to render
Excel files as HTML, or to render TIFFs to JPEGs, etc.

The HttpModules are used for Uri handling, so that a request for a
resource
like;

http://somesite.com/file/sales_data.xls

...gets converted to something internally meaningful, like a database
query
or a retrieval action from a third-party content management system.

Unfortunately with the HttpModule installed, the HttpHandlers never run;
so
even with an HttpHandler registered to handle the ".xls" file type, the
raw
Excel file is returned to the client rather than the HttpHandler-generated
content.

Is there something that I need to do in the HttpHandler to ensure that the
normal chain of processing continues? Or could Uri-rewriting be confusing
the situation, such that a conversion of;

http://somesite.com/file/sales_data.xls

...to...

http://somesite.com/getfile.aspx?FileID=103

...would prevent the matchup of the request to the defined HttpHandlers?

Yes. Try not changing the extension and see what happens.

John Saunders
 
M

MWells

I'm not certain how to execute the ASPX page without actually calling it.
Are you saying that I have to put my retrieve-data code in the HttpModule
directly, rather than doing a Url rewrite to a separate ASPX page?

Alternatively, would doing a Server.Transfer instead of Url rewriting make a
difference?
 
J

John Saunders

MWells said:
I'm not certain how to execute the ASPX page without actually calling it.
Are you saying that I have to put my retrieve-data code in the HttpModule
directly, rather than doing a Url rewrite to a separate ASPX page?

Alternatively, would doing a Server.Transfer instead of Url rewriting make
a
difference?

What I was getting at was that you should try not changing the extension and
then see if it hits your HttpHandler. Not that the handler will _work_, but
see if it gets there.

John Saunders
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top