Search code examples
c#urlhttpmodule

Request.Url and ReferrerUrl in HttpModule


We are finding HttpContext.Current.Request.Url.ToString() and HttpContext.Current.Request.UrlReferrer.ToString() values in an httpmodule. Is there any difference in getting the values from the normal page load?

Suppose if the request is coming from a google search result, then what will be the output of those two values.


Solution

  • HttpContext.Current.Request.Url points to the resource on your server while UrlReferrer is the URL which requested the resource.

    if the request is coming from google search, UrlReferrer will give you google url something like http://www.google.com/search?q=[some text]