1

I want to get Page referrer URL in order to keep record that invalid URL exists on which Page. I have given try to :

  1. Page.Request.ServerVariables["HTTP_REFERER"]
  2. HttpContext.Current.Request.UrlReferrer

These both returns invalid URL instead of the page from which link was clicked.

4
  • Try using HttpRequest.UrlReferrer. msdn.microsoft.com/en-us/library/…
    – jpollar
    Jan 16, 2016 at 1:38
  • @jpollar, I already have tried this as I said in my question that this returns Invalid URL (page which was not found), instead of the page from where using is coming from. Jan 16, 2016 at 21:00
  • I've had success with just Request.UrlReferrer also. Have you tried that? You may want to look at this post also. stackoverflow.com/questions/149130/request-urlreferrer-null
    – jpollar
    Jan 18, 2016 at 15:19
  • Actually, this works fine only when user is opening a valid link (page that exists), but if user opens invalid link(page that has been deleted or wrong url), SharePoint redirects to 404 page, and in this case I want to retrieve the source page url from where User has clicked this link, but this Request.UrlReferrer gives the url which user has clicked, not the source URL, from where user is coming from. Jan 19, 2016 at 6:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.