Knowing the next URL in IHttpModule Class

Last post 11-15-2009 1:31 AM by RickNZ. 1 replies.

Sort Posts:

  • Knowing the next URL in IHttpModule Class

    11-10-2009, 6:44 AM
    • Member
      16 point Member
    • rbonigala
    • Member since 11-06-2008, 9:36 AM
    • Posts 13

    Hi All,

    I am implementing a class from HttpModule. Here, is there a way by which I can know the destination URL.

    Example, In one of my web pages, there will be multiple links which redirect the user to various websites like google, yahoo, etc. I want to know, which is the URL that user is redirected. My class will be called whenever this page is called.

    Any help will be highly appreciated.

    Filed under: ,
  • Re: Knowing the next URL in IHttpModule Class

    11-15-2009, 1:31 AM
    Answer
    • Contributor
      5,210 point Contributor
    • RickNZ
    • Member since 01-01-2009, 3:43 AM
    • Nelson, New Zealand
    • Posts 862

    By default, the only thing you can see in an HttpModule is the URL of the current page and the URL of the Referring page.  When a user clicks on a link on your page, by default your server isn't notified.

    To do what you're asking for, you would need to do something like: write some JavaScript for your page that adds the URL of the new page to a query string for a page on your site.  That page, or perhaps some related code, would then intercept the incoming URL and look at the query string.

    Another approach would be to have the <a> tags on your page go to a page on your site that would then issue a redirect to the final destination page.  That's what Google does, for example, on their search results page.


Page 1 of 1 (2 items)