[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to get the referral site URL

Posted on 2007-12-05
5
Medium Priority
?
2,457 Views
Last Modified: 2009-02-18
How do I capture the referral site(From which the user came to my site. The link on which brought my user to my site) and take the user back to that page when he is done with mine?

0
Comment
Question by:netsol07
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20415842
Hi,
To get the referring Url, you can use

Request.UrlReferrer.ToString()

and you can use the response redirect, to redirect the user back to that url, so the complete operation would be like this

Response.Redirect(Request.UrlReferrer.ToString())
0
 
LVL 22

Expert Comment

by:RedKelvin
ID: 20415855
oh, I should also point out that you need to use the System.Web.HttpContext.Current namespace for the request and response objects. put this at the top of your code outside the class


imports System.Web.HttpContext.Current

Open in new window

0
 
LVL 7

Expert Comment

by:nisarkhan
ID: 20415944
You can use Request.ServerVariables("HTTP_REFERER") to get the referral URL in your ASP pages. Read more about the Request.ServerVariables collection here:

http://www.aspdev.org/articles/asp-servervariables/ 
0
 

Author Comment

by:netsol07
ID: 20423419
Hi RedKelvin,

I've did what you suggested as my application is in asp.net.
I'm wondering what would be the better way to test it because I'm always getting "" for refuri.
(I have placed the new site link in one of my old apps and ran from there)
0
 
LVL 22

Accepted Solution

by:
RedKelvin earned 1000 total points
ID: 20448128
did the previous page link to that page, otherwise the referrer will be ""
0

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question