如何在ASP DOT NET中永久重定向?我想从我网站上一页的301重定向到另一个页面。
@H_301_2@
解决方法
protected void Page_PreInit(object sender,EventArgs e) { Response.StatusCode = 301; Response.StatusDescription = "Moved Permanently"; Response.RedirectLocation = "AnotherPage.aspx"; HttpContext.Current.ApplicationInstance.CompleteRequest(); }
在4.0中,有一个简单的HttpResponse.RedirectPermanent()
方法可以为您做上述任务:
Response.RedirectPermanent("AnotherPage.aspx");@H_301_2@ @H_301_2@