ASP.Net检测引荐来源是否来自301永久重定向 [英] ASP.Net Detecting if referrer was from a 301 permanent redirect

查看:65
本文介绍了ASP.Net检测引荐来源是否来自301永久重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行从旧服务器到新服务器的301永久重定向.当新服务器的页面被点击时,我希望能够确定用户是否来自旧站点,然后做出不同的反应,即指示用户重新标记新页面.

I am doing a 301 permanent redirect from an old server to a new server. When the new server's page is hit I want to be able to determine whether the user comes from the old site and then react differently, i.e. instruct user to re-book mark the new page.

关于如何确定引荐来源网址是否为永久重定向的任何建议?

Any suggestions on how to determine if the referrer was a permanent redirect?

TIA

J

推荐答案

浏览器通常会处理此类问题,并且大多数浏览器从301永久重定向返回时都不会传递引荐来源网址.RFC标准未指定是否应传递引荐来源信息,因此您不能期望这种行为.

The browser typically handles this sort of thing, and most browsers do not pass on a referrer when coming from a 301 permanent redirect. The RFC standard does not specify whether or not referrer information should be passed, so you can't expect that behavior.

如果要重定向到相同的主域,则可以尝试Cookie值.您也可以尝试使用特殊的查询字符串进行重定向,例如?from = oldsite 或类似的内容,以解决此问题.

If you are redirecting to the same primary domain, you can try a cookie value. You can also try redirecting with a special querystring, like ?from=oldsite or something along those lines in order to solve this issue.

这篇关于ASP.Net检测引荐来源是否来自301永久重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆