产品使用及交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

设置好404错误页,只能返回302代码。 [复制链接]

1#
己经设置好的404错误页,可以正常跳转到错误页,非 aspx 页可以正常返回404错误代码。   但 aspx 返回的错误代码为302 ,  按网上的方法,修改web.config 和 重新制作404页面,  都没有用, 可以跳转到错误页,但返回的代码302或200  ,有什么办法可以返回404代码, 对于搜索引擎来说,这太重要了。
分享 转发
深圳公司注册: http://www.szwhcw.com
TOP
2#

asp.net特性导致的,网上很多间接实现方法,比如:http://www.cnblogs.com/death029/archive/2011/07/29/2120889.html
TOP
3#

asp.net特性导致的,网上很多间接实现方法,比如:http://www.cnblogs.com/death029/archive/2011/07/29/2120889.html
xiyou 发表于 2013-8-21 9:49:49


不知道如何使用呀。  谁能详细说下。先谢了


[url=][/url]
protected void Application_Error(object sender, EventArgs e)
{
    Response.Clear();
    Response.StatusCode = 404;
    Response.Write("<html xmlns=\"http://www.w3.org/1999/xhtml/" ><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>页面没有找到</title><meta http-equiv=\"refresh\" CONTENT=\"0; url=/\"></head><body><div>" +
    "<div style=\"display:none;\">页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到页面没有找到</div></div></body></html>");
    Response.End();
}[url=][/url]
深圳公司注册: http://www.szwhcw.com
TOP
4#

不知道如何使用呀。  谁能详细说下。先谢了
深圳公司注册: http://www.szwhcw.com
TOP
发新话题 回复该主题