解决方法
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");