Asp.net Response.Redirect - 不正确的引荐来源网址
我有一个用于流量跟踪的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 ASPX 页面尝试以下解决方案之一:
1.. 尝试从代码隐藏将元刷新标记添加到 aspx 页面的标头。
2.. 从代码隐藏中将 Javascript 添加到您的页面
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.
2.. Add Javascript to your page from the codebehind
引用者由浏览器控制,因此您可能无法做很多事情来改变它的想法。有可以使用的技巧,但仅此而已。
您是否尝试过使用 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?
就像提到的48klocs。只是没有一个好的方法来做到这一点。也走过了这条路,很糟糕。
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
某些客户端和防病毒软件会删除甚至用垃圾填满它。
http://en.wikipedia.org/wiki/HTTP_referrer
Some clients and anti virus software will remove or even fill it with junk.