Request.UrlReferrer is null, what gives?

Request.UrlReferrer is null, what gives?

 

ConfusedI was looking for a consistent way to be able to know the url a user was coming from when loading a page. I came across the Request.UrlReferrer property of the page, and thought “hey, this is exactly what I need!”, but that wasn’t the case. It was working in some instances, and was coming up null in other instances, I wasn’t sure exactly what causing the null value so I did a little research. Basically this referrer property is optionally set by the browser, and should never really be relied on to be consistent.

From http://forums.asp.net/t/1097333.aspx/1 “gopalanmani” lays it out pretty clearly. Thanks!

The situations where it does work include the following methods of a browser loading a URL:

  • clicking on a straight HTML <a href> link;
  • submitting a form, using POST or GET, from a submit button, <input type=image> or client-side script (form.submit())

The situations where it doesn’t work:

  • using Response.Redirect / Server.Transfer;
  • clicking on a Favorite, History, or the recently-typed URLs list;
  • clicking on ‘Home’ in IE’s toolbar, or an item in IE’s ‘Links’ toolbar;
  • using location.href or location.replace() in client-side JScript/JavaScript/VBScript;
  • using HierMenus (details);
  • typing the URL directly in the browser and hitting Enter or clicking ‘Go’;
  • launching a clickable URL from an e-mail or MS Office document;
  • using Response.AddHeader  or <meta http-equiv=refresh> to redirect;
  • loading the URL with XML

 

So basically, beware when using this property. Depending on what browser is being used, and how the user came to the page, this property may not be consistently set.

Share Your Thoughts!

Testimonials

What My Clients Say

Karin - Hope and Future

Brent has always been very prompt and generally exceeds our expectations with his work. His maintenance fee is very reasonable. I strongly recommend him!  We get many compliments on our beautiful web site!

Dan

I contacted Krueger Web Design and Brent did everything.  He setup a test site with the changes so we could verify everything was correct before we transferred from my old hosting provider.  During the setup and conversion Brent was extremely professional and responsive. He responded to any issues the same day.

Dan Kaufman
Emily - GFCLT

We've had a great experience working with Krueger Web Design. Prompt responses, great ideas, effective work... all at a reasonable price! This was the perfect fit for our organization.

Mahmud - ACMC

I would love to recommend you to anyone! You have been very helpful when we needed you the most.

Brian - SEMNIC

Working with Krueger Web Design was effortless. Communicating what I wanted for the website and the results that I saw were identical. The customer service was always prompt and I am completely satisfied with the product.

Zach - Stadium Club

Exactly what I wanted! Fast turnaround time and very affordable. Answered all of our questions quickly and made adjustments promptly. Very easy to work with and puts everything into terminology that even I can understand!

Contact Krueger Web Design

Have a question for me? Need an estimate on some work? You can email me at brent@kruegerwebdesign.com or drop me a line using the button below:

Copyright © 2017 Krueger Web Design - All rights reserved
Web Design in Madison, WI