How to transfer execution to ASPX page from custom handler

Discussion in 'ASP .Net' started by Stanislav Ostachevski, Oct 22, 2003.

  1. Hello,

    My app needs to map calls to "virtual files" to ASPX parametrized pages,
    without showing user actual page address.
    I.e, I want to catch calls to
    http://myserver.com/products/id_product/somefeature.ashx
    and redirect them to
    http://products.myserver.com/product.aspx?id=id_product&features=....
    but I don't want to reveal the actual URL of product.aspx
    I catch all calls to ashx files by custom HTTP handler.
    There's a problem: I can't use Server.Transfer call due to IIS redirection
    issue (IIS can't redirect call to another DLL)
    Microsoft suggests using Page.Redirect, but in this case new address will be
    revealed, so I can't do so.

    And I can't get reference to private PageHTTPHandler class.
    Any advise would be greatly appreciated.
     
    Stanislav Ostachevski, Oct 22, 2003
    #1
    1. Advertising

  2. "Stanislav Ostachevski" <> wrote in message
    news:#...
    > Hello,
    >
    > My app needs to map calls to "virtual files" to ASPX parametrized pages,
    > without showing user actual page address.
    > I.e, I want to catch calls to
    > http://myserver.com/products/id_product/somefeature.ashx
    > and redirect them to
    > http://products.myserver.com/product.aspx?id=id_product&features=....
    > but I don't want to reveal the actual URL of product.aspx
    > I catch all calls to ashx files by custom HTTP handler.
    > There's a problem: I can't use Server.Transfer call due to IIS redirection
    > issue (IIS can't redirect call to another DLL)
    > Microsoft suggests using Page.Redirect, but in this case new address will

    be
    > revealed, so I can't do so.
    >
    > And I can't get reference to private PageHTTPHandler class.
    > Any advise would be greatly appreciated.


    This sort of thing should be done in an HttpModule, not an HttpHandler.
    You're not actually "handling" the request. Instead you're modifying it and
    then allowing the request to pass to the handler.

    Your handler could check the request and do nothing if it's not a request
    for a .ashx page. Otherwise, it could modify the URL with
    HttpContext.RewritePath. The actual handler for .ashx pages should be the
    same one that handles .aspx pages.

    John
     
    John Saunders, Oct 22, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ram
    Replies:
    0
    Views:
    609
  2. aaa
    Replies:
    0
    Views:
    461
  3. Replies:
    1
    Views:
    466
    Kevin Spencer
    Aug 28, 2007
  4. TS
    Replies:
    7
    Views:
    1,462
  5. MichaelS
    Replies:
    0
    Views:
    420
    MichaelS
    Nov 22, 2006
Loading...

Share This Page