我们知道IIS的301设置非常的简单,不懂得可以去百度下。
编程方式使用下面的代码
答案: /// <summary>
/// 设置301跳转
/// </summary>
/// <param name="Url">要跳转的URL</param>
public static void SetURL301(string Url)
{
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.StatusCode = 301;
System.Web.HttpContext.Current.Response.Status = "301 Moved Premanet";
System.Web.HttpContext.Current.Response.AddHeader("Location", Url);
}
//在你的页面pageload事件中编写就可了,如果有其他的需要,自行解决哦