几种跳转方式的区别
301 Redirect: 代表永久转义
302 Redirect: 暂时转移
200 : 在服务器上完成了页面的转移, 对客户端完全透明
302 Redirect 由于是暂时转移,如果把自己的网址A转到一个网址B上, google 等抓取工具可能会把你的网址A作为网站B内容的入口点, 这样网址B 就被劫持了。
所以, 如果你网站要用302 转移, 千万要慎重, 如果被google误认为是恶意劫持, 可能就会被加入黑名单了。
asp.net 实现这些的方法
301 Redirect:
Response.Clear();
Response.StatusCode = 301;
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "/Homepage/default.aspx");
302 Redirect:
Response.Redirect("Homepage/Default.aspx");
200 无错误代码的使用转移
Server.Transfer("/Homepage/Default.aspx");