Re: Using an HttpHandler to redirect a certain extension to ASPX pages behind the scenes

From: Kevin Spencer (kevin_at_takempis.com)
Date: 03/04/04


Date: Thu, 4 Mar 2004 15:34:46 -0500

Why don't you just assign ASP.Net as the handler for this extension? Then
you don't need an HttpHandler to redirect. ASP.Net will handle the request,
and your ASP.Net pages would just have to have the same extension.

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Kentamanos" <anonymous@discussions.microsoft.com> wrote in message
news:2F1D78A9-5663-4605-A386-05578BFB7AF3@microsoft.com...
> Please don't ask me why I'm doing this (trust me, it makes sense in my
system), but I'd like to basically redirect requests for a certain extension
(thus a handler) to an ASPX page behind the scenes.
>
> I've created a handler and set it up to handle the extension in question.
In my ProcessRequest, I'd like to basically figure out which ASPX page to
"forward" the request to. I've tried all sorts of methods (Server.Transfer
and Server.Execute for instance), but they all have their downfall.
>
> One problem is the ASPX page in question always sets his form "action" to
the name of his own page (ending in ASPX). I'd like the "action" to be the
URL I'm currently at (which will in turn eventually get handled by the same
ASPX page). I figured out a cheesy way to get the action to properly have
the correct output by using the Server.Execute overload that allows you to
redirect the output to a TextWriter and then modifying the output and
sending that out. The problem with that approach is now the IsPostback of
the actual page never thinks it's a post back and controls never get their
events fired.
>
> Does anyone know of a way to do what I'm trying to do?


Relevant Pages

  • Re: httpHandlers
    ... It is the extension that identifies the handler to the web server. ... We are only rewriting URLs with aspx extensions e.g. ... "normal" request that needs to be rewritten. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: httpHandlers
    ... It is the extension that identifies the handler to the web server. ... We are only rewriting URLs with aspx extensions e.g. ... "normal" request that needs to be rewritten. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: httpHandlers
    ... ..aspx extension exclusively with your HttpHandler. ... It is the extension that identifies the handler to the web server. ... "normal" request that needs to be rewritten. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Using an HttpHandler to redirect a certain extension to ASPX pages behind the scenes
    ... You would have to add an ISAPI mapping in IIS, ... Request transferred to an ASP.Net Page without the problem you're describing ... that extension with the same DLL that ASPX is associated with in the IIS ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: httpHandlers
    ... ..aspx extension? ... We are doing custom request rewriting in a httpModule in ... Application.AuthenticateRequest for requests coming in with .aspx using ... a request as a request to a handler? ...
    (microsoft.public.dotnet.framework.aspnet)