你好我正在尝试做一个重定向如果响应是一个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