Search code examples
asp.neturlhttpmodule

Get url string in PreRequestHandlerExecute in asp.net


I have a class that implements IHTTPModule which handles the event PreRequestHandlerExecute. In the method of that event i want to get the url of the page that executed the call.

So for instance if i have a SignOn.aspx page, which then redirects to an Index.aspx page, in my method i want to be able to get the SignOn.aspx url.


Solution

  • If you are doing a redirect, you should find the page where the request came from in the

    Request.UrlReferrer

    This property gives the information from the Referer http header.