httpHandlers

G

Guest

Hi,

We are doing custom request rewriting in a httpModule in
Application.AuthenticateRequest for requests coming in with .aspx using
HttpContext.RewritePath().

We are having a problem identifying requests that come in from registered
httpHandlers i.e. handlers with extension .aspx. These should just fall
through and not be analyzed/rewritten. Is there a way (flag?) that identifies
a request as a request to a handler? The Context.CurrentHandler is not yet
set this early.

We could always read the configuration data but since handlers can be added
further down in the config hierarchy we cannot cache it and it seems like a
costly operation.

Grateful for any ideas.

Thanks,
Manso
 
G

Guest

Hi John,

Thanks for your prompt reply.

We are only rewriting URLs with aspx extensions e.g.

www.site.com/products/category1/My-item1.aspx

will be rewritten as

www.site.com/products.aspx?item=My-item1&cat=category1

This means we have to react to all aspx-request. We check to see if the file
physically exists and skipped it if it did so existing pages (such as
product.aspx in the example above) would execute as normal.

Problem with HttpHandler is that they don't exist in the file system and in
our application we won't be able to tell whether it's a httpHandler or a
"normal" request that needs to be rewritten. We somehow need to be able to
identfy this as a call to a handler. Third party apps can register themselves
as handlers ("getfile.aspx", "makereservation.aspx" etc).

Thanks,
- Manso
 
K

Kevin Spencer

Your custom HttpHandler should use a different file extension than "aspx."
It is the extension that identifies the handler to the web server.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
G

Guest

Hi Kevin,

Thanks for your reply.

In theory - you're right. The problem is third party controls from e.g.
Telerik uses handlers for spellchecking, file upload etc and they're all
using extension aspx. This is natural as you need to change the mapping and
metadata in IIS to make it work otherwise which is a pain when deploying the
solution.

Any other ideas?

Thanks,
Manso
 
K

Kevin Spencer

The only thing I can think of is to set up a virtual directory that uses the
..aspx extension exclusively with your HttpHandler.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
G

Guest

Thanks, we ended up iterating through the configuration storage and caching
the httpHandlers with .aspx extension available for the application in a
string collection in the runtime cache. For each request we check against
that collection and ignores all request contained in the collection. Works
for now but is not bullet proof.

Thanks for your suggestions.

Manso
 

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