Murali Bala
Murali Bala

Reputation: 1143

ASP.NET UrlReferrer

I have an ASP.Net application which generates short url for sharing. I want to track the url from where (source) click occured when it hits my asp.net page. I tried using Context.Request.UrlReferrer.AbsoluteUri but all I get from it is null.

Any ideas?

TIA

Upvotes: 1

Views: 1886

Answers (2)

pattermeister
pattermeister

Reputation: 3232

Don't forget that the referrer will sometimes be null for things like search engines, or people behind corporate firewalls that remove some HTTP headers.

Upvotes: 1

Agent_9191
Agent_9191

Reputation: 7253

Not quite as clean, but you could use Request.Headers["Referer"]. Should be the same as using Context.Request, but I've found the behavior to be different.

Upvotes: 0

Related Questions