I have a asp.net application that i use for traffic tracking.
I get a incoming visitor from several source websites and redirect the visitor to the target website using Response.Redirect(url);
The problem is that currently the referer shown to the target website (after i redirect) is of the url of the source website and not my website.
how do i clear/change the referer before using the Response.Redirect?
This is my code of Default.aspx:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
Response.Redirect(url);
}
catch (System.Threading.ThreadAbortException) { }
}
}
Thanks.
From the ASPX page try one these solutions:
1.. Try adding a meta refresh tag to the header of your aspx page from the codebehind.
Response.AppendHeader("Refresh", "0; url=http://targetsite.com");
2.. Add Javascript to your page from the codebehind
Page.RegisterStartupScript("myScript", "<script language=JavaScript>window.location = "http://targetsite.com";</script>");
The referer is controlled by the browser, so there's probably not a whole lot you can do to change its mind. There is a hack you can put to use , but it is just that.
Have you tried doing a Server.Transfer instead?
Like 48klocs mentioned. There just isn't a good way to do this. Been down the road too and it sucks.
http://en.wikipedia.org/wiki/HTTP_referrer
Some clients and anti virus software will remove or even fill it with junk.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.