zoukankan      html  css  js  c++  java
  • 004. 连接默认错误页

    1. 在项目中添加一个默认错误页面 error.aspx ; 注意错误页面一般使用静态页面即可, 没有必须要使用aspx的页面(除非有特殊需求), 即可指定html页面即可, 下面的演示是基于aspx的页面;

     1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="error.aspx.cs" Inherits="error" %>
     2 
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     4 
     5 <html xmlns="http://www.w3.org/1999/xhtml">
     6 <head runat="server">
     7     <title></title>
     8 </head>
     9 <body>
    10     <form id="form1" runat="server">
    11     <div>
    12     我是默认错误页面!!!!
    13     </div>
    14     </form>
    15 </body>
    16 </html>

    2.然后在web.config的system.web节点下添加如下内容:(此时访问该网站下一个不存在的页面, 将会跳转到该页面中)

    1 <customErrors defaultRedirect="error.aspx" mode="On"></customErrors>
  • 相关阅读:
    Python 爬虫一 简介
    linux 基础笔记本
    Celery 分布式任务队列快速入门
    Git & Github
    Python 设计模式
    Python 数据结构
    Python 基础算法
    js2wordcloud 词云包的使用
    lambda 3
    sql server 远程
  • 原文地址:https://www.cnblogs.com/wxylog/p/6030617.html
Copyright © 2011-2022 走看看