.NET Daily


How to Get External URL Reference in ASP.NET

Posted on .

How to Get External URL Reference in ASP.NET


We recently had a requirement to track the initial location of our users in a Single Sign On environment.

One essential information that was needed for this requirement was to get the previous external URL from which the user came in our website.

The external URL can be very easy extracted with the following code:

NOTE: If the users type the URL directly into the navigation bar of the browser, the “HTTP_REFERER” will be null regardless of the website that they currently have loaded. If fact the above code returns the external URL only in the case of a redirect from the source (hyperlink or response.redirect method).

One more thing, I also have discovered a possibility to extract markup from a page by specifying it’s URL. Below you have code to extract the title of a page by specifying it’s URL:



Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.

There are no comments.

View Comments (0) ...