在web.config里面加入这段:
<customErrors mode="On" defaultRedirect="error404.aspx">
<error statusCode="404" redirect="error404.aspx" />
</customErrors>
添加一个404的页面,在后台输入
protected void Page_Load(object sender, EventArgs e)
{
Response.Status = "404 Not Found";
}