Asp.net Response.Redirect - Invalid referrer

I have an asp.net application that I use to track traffic.

I get an incoming visitor from several source sites and redirect the visitor to the target site using Response.Redirect (url);

The problem is that the referent shown on the target website (after the redirect) currently refers to the URL of the original website, and not to my website.

How to clean / change referent before using Response.Redirect?

This is my Default.aspx code:

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.

+4
source share
4 answers

On the ASPX page, try the following solutions:

1. Try adding the meta refresh tag to the title of your aspx page from code.

 Response.AppendHeader("Refresh", "0; url=http://targetsite.com"); 

2 .. Add Javascript to your page with codebehind

 Page.RegisterStartupScript("myScript", "<script language=JavaScript>window.location = "http://targetsite.com";</script>"); 
+2
source

The referent is controlled by the browser, so maybe you can’t do much to change your mind. There is a hack that you can use , but it is.

Have you tried using Server.Transfer?

0
source

As mentioned 48klocs. Just not the best way to do this. On the road, too, and that sucks.

0
source

http://en.wikipedia.org/wiki/HTTP_referrer

Some clients and antivirus software remove or even fill it with junk.

0
source

Source: https://habr.com/ru/post/1314102/


All Articles