views:

1101

answers:

5

Should Request.UrlReferrer be null in Page_Load when the page came from another site?

How do I check where the page came from? From google, yahoo?

It's not coming from a bookmarked page or anything, it's just a link being redirected to this page from another site.
I know that it's not a reliable way to check where the page came from, but that's not the purpose. Users actually wont be able to type in the Url
Thanks,

My solution was sending the entire URL from the previous page to target page using js, and check for the parameters that I'm interested in

A: 

Request.UrlReferrer is not always set. It is not reliable.

John Saunders
+2  A: 

It's not required for browsers to send it, and some allow users to disable it from being sent for security purposes. Also, if someone followed a bookmark, it won't be set.

Joe
A: 

The referring url is not a reliable way of checking where the user came from necessarily. If someone simply types in a URL, or clicks on one of their bookmarks, the referrer will be null.

The referring header really depends on the behaviour of the web browser that the user is using, and how it is set up.

womp
A: 

UrlReferrer is not reliable. You can use google webmaster tools to find out how many times users come to your page from google

ArsenMkrt
+1  A: 

Like others have said... its not reliable.

Maybe setup a Google Analytics account, they provide a great amount of information about your visitors.

check it out Google Analytics

YetAnotherDeveloper
UrlReferrer gets its information from the same HTTP header that google analytics does. If this header is not present (i.e. UrlReferrer is null), GA won't have any info on it either.
Chris
I understand this... i was just trying to provide an options so that the OP could track some of the visitor details.
YetAnotherDeveloper