HI我試圖重定向頁面,如果HttpError是404 它正在完善本地主機上,而在直播現場是沒有的。頁面不是從應用程序錯誤重定向,
這裏是我的代碼
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
HttpException serverError = Server.GetLastError() as HttpException;
if (serverError != null)
{
int errorCode = serverError.GetHttpCode();
if (errorCode == 404)
{
Server.ClearError();
if (Request.Url.ToString().Contains("contact.php"))
{
Response.Redirect("contact-us.aspx");
}
}
}
}
感謝。請告知如何讓這個工作在現場,
這對於只有一個頁面是有用的..我有更多的1頁來重定向 – dnts2012