ASP.NET aspx页面301永久跳转, 301文本代码跳转转向地址指定文件
页面永久跳转,适合网站改版使用
原页面:http://www.abc.com/about.aspx
新页面:http://www.abc.com/about-new.aspx
about.aspx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <%@ Page Language= "C#" %> <script runat= "server" > /// <summary> /// 初始化页面 /// </summary> protected void Page_Load( object sender, EventArgs e) { HttpContext.Current.Response.StatusCode = 301; HttpContext.Current.Response.Status = "301 Moved Permanently" ; HttpContext.Current.Response.AddHeader( "Location" , "about-new.aspx" ); //HttpContext.Current.Response.AddHeader("Location", "http://www.xxx.com/about-new.aspx"); HttpContext.Current.Response.End(); } </script> |
CTRL+D快速收藏,欢迎常来喔