Asp.Net 小型网站的制作(六),涵盖了asp.net里面所有的基础知识

下面就是当连接数据库出错的404页面非常简单

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="404.aspx.cs" Inherits="WebSql.Error._404" %>

<!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 runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align:left;">
    由于服务器正在维护,给您造成的不便敬请谅解,请稍后重新登录!
     <table style="width:100%;height:100%;">
     <tr>
     <td style=" text-align:center;">
     <img src="../../Img/Error01.gif" style="height: 312px; width: 319px" />
     </td>
     </tr>
     <tr>
     <td style="text-align:center;font-family:@楷体; font-size:36px; ">
     <p>&nbsp;Error 服务器正在维护,请稍后! </p>
     </td>
     </tr>
     </table>
    </div>
    </form>
</body>
</html>

还有一个重要的类,就是验证登录的类,和空值分页大小的类

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BusinessRules;

namespace WebSql.Mypublic
{
    public class MyPage : System.Web.UI.Page
    {
        public int myPageSize
        {
            get
            {
                int myPageSize = 10;//默认的分页数
                try
                {
                    string temp = System.Web.Configuration.WebConfigurationManager.AppSettings["myPageSize"];
                    myPageSize = int.Parse(temp);
                }
                catch
                {
                    return myPageSize;
                }
                return myPageSize;//用户自定义的分页数
            }

        }

        public void CheckLogin()  //验证是否登录
        {
            if (Session["LoginMessage"] == null)
            {
                string url = "../List/Login.aspx";
                Response.Redirect(url, true);
            }
        }
        public void ShowMessageBox(string messsge)//弹出窗口
        {
            Response.Write("<script language=javascript> alert('" + messsge + "')</script>");
        }
        string color = "#E9F1F3";

        public string Color
        {
            get { return color; }
            set { color = value; }
        }
    }
}

这个网站的基本功能就已经完成!还有一些验证的页面,在之前的文章中就已经讲过!所以在这里就不做过多的说明了!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值