ASP.NET 页面404设置

Web.config

<system.webServer>
    <!--404-->
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404"/>
      <error statusCode="404" responseMode="ExecuteURL" path="/404.aspx"/>
    </httpErrors>
  </system.webServer>

404.aspx
<%@ Page Language="C#"%>

<script runat="server">
    /// <summary>
    /// 页面载入
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Status = "404 Not Found";
    }
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>404 Not Found</title>
</head>
<body>
   404 Not Found
</body>
</html>


作者最新文章
Winform TextBox (文本框) 密码输入框, 输入内容显示*号 (星号)
Winform 启动前弹出登录界面, 登录成功之后再显示主界面
C# 字符串string和字符数组char[]的相互转换
C# 字符串倒序输出, 实现字符串倒序的方法
Winform 如何从 TextBox(文本框) 控件读取每一行数据到数组