Asp.net Response.Redirect - 不正确的引荐来源网址

发布于 2024-09-07 17:51:38 字数 637 浏览 0 评论 0原文

我有一个用于流量跟踪的 asp.net 应用程序。

我从多个源网站收到传入访问者,并使用 Response.Redirect(url); 将访问者重定向到目标网站;

问题是,目前显示给目标网站的引荐来源网址(在我重定向后)是源网站的网址,而不是我的网站。

在使用 Response.Redirect 之前如何清除/更改引用者?

这是我的 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) { } 
            } 
        } 

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鸠魁 2024-09-14 17:51:38

从 ASPX 页面尝试以下解决方案之一:

1.. 尝试从代码隐藏将元刷新标记添加到 aspx 页面的标头。

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

2.. 从代码隐藏中将 Javascript 添加到您的页面

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

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>");
日记撕了你也走了 2024-09-14 17:51:38

引用者由浏览器控制,因此您可能无法做很多事情来改变它的想法。有可以使用的技巧,但仅此而已。

您是否尝试过使用 Server.Transfer 来代替?

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?

哽咽笑 2024-09-14 17:51:38

就像提到的48klocs。只是没有一个好的方法来做到这一点。也走过了这条路,很糟糕。

Like 48klocs mentioned. There just isn't a good way to do this. Been down the road too and it sucks.

星光不落少年眉 2024-09-14 17:51:38

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

某些客户端和防病毒软件会删除甚至用垃圾填满它。

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

Some clients and anti virus software will remove or even fill it with junk.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文