你好我正在嘗試做一個重定向如果響應是一個404,但它沒有按預期工作,你可以專家看到這個問題?它還是到通用的404404自定義重定向
在我的Global.asax
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Response.Status == "404 Not Found")
{
string notFound = "~/custom_notfound.aspx";
Response.Redirect(notFound);
}
}
UPDATE
試過到目前爲止
(Response.Status == "404 Not Found")
(Response.Status == "404")
(Response.StatusCode == 404)
您的意思是把'的Response.Redirect(NOTFOUND);'? – Icarus
PageNotFound是什麼? –
ahh對不起,當張貼錯別字,但仍然有問題。謝謝 – user710502