By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,625 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,625 IT Pros & Developers. It's quick & easy.

HttpModule preventing execution of HttpHandlers

P: n/a
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

Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"MWells" <outbound__at_sygnal.com> wrote in message
news:ev**************@TK2MSFTNGP10.phx.gbl...
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
Nov 19 '05 #2

P: n/a
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?
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:ub*************@TK2MSFTNGP11.phx.gbl...
"MWells" <outbound__at_sygnal.com> wrote in message
news:ev**************@TK2MSFTNGP10.phx.gbl...
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

Nov 19 '05 #3

P: n/a
"MWells" <outbound__at_sygnal.com> wrote in message
news:er****************@TK2MSFTNGP14.phx.gbl...
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
"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:ub*************@TK2MSFTNGP11.phx.gbl...
"MWells" <outbound__at_sygnal.com> wrote in message
news:ev**************@TK2MSFTNGP10.phx.gbl...
> 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


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.