国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

從零開始編寫自己的C#框架(15)——Web層后端登陸功能

2019-11-17 01:34:36
字體:
來源:轉載
供稿:網友

從零開始編寫自己的C#框架(15)——Web層后端登陸功能

  對于一個后端管理系統,最重要內容之一的就是登陸頁了,無論是安全驗證、用戶在線記錄、相關日志記錄、單用戶或多用戶使用帳號控制等,都是在這個頁面進行處理的。

  1、在解決方案中創建一個Web項目,并將它設置為啟動項

  

  2、添加引用

  

  

  

  3、添加WebManage文件夾與Login.aspx文件

  

  

  4、添加登陸頁面HTML代碼  

 1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Solution.Web.Managers.WebManage.Login" %> 2  3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 <html xmlns="http://www.w3.org/1999/xhtml"> 5 <head id="Head1" runat="server"> 6     <title>從零開始編寫自己的C#框架——后端管理系統</title> 7     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 8     <link rel="stylesheet" href="CSS/login.css" /> 9     <script type="text/javascript">10         function Random(n) { return (Math.floor(Math.random() * n)); };11 12         function AjaxRnd() { return new Date().getTime() + '' + Random(10000); };13 14         function ShowKey() {15             document.getElementById("img_verifycode").src = "Base/Vcode.ashx?a=" + AjaxRnd();16         };17     </script>18 </head>19 <body>20     <!--CENTER開始-->21     <div class="login-container">22         <form id="form1" runat="server">23         <div class="login-header">24             <h3>25                 Login</h3>26         </div>27         <div id="login-content" class="clearfix">28             <div>29                 <label>30                     用戶名</label>31                 <div>32                     <asp:TextBox runat="server" ID="txtusername" CssClass="input w92" />33                 </div>34                 <label>35                     密碼</label>36                 <div>37                     <asp:TextBox runat="server" ID="txtpass" CssClass="input w92" TextMode="PassWord" />38                 </div>39                 <label>40                     驗證碼</label>41                 <div>42                     <asp:TextBox runat="server" ID="txtcode" CssClass="input w100 fl" />43                     <asp:Image ID="img_verifycode" runat="server" onclick="ShowKey();" ToolTip="更換驗證碼"44                         ImageUrl="Base/Vcode.ashx" />45                     <div class="fc"></div>46                 </div>47             </div>48             <div>49                 <asp:Button ID="BtnLogin" CssClass="btn" runat="server" OnClick="BtnLogin_Click"50                     Text="登陸" />51             </div>52         </div>53         </form>54     </div>55     <!--CENTER結束-->56 </body>57 </html>
View Code

  css樣式在本文后面的解決方案中有

  瀏覽一下效果

  

  5、后端管理系統登陸驗證流程圖

  我們根據下面的流程圖來編寫登陸頁代碼

  6、添加在線列表數據表并修改管事員表相關字段

  執行下面SQL語句

  1 /****** Object:  Table [dbo].[Manager]    Script Date: 2014/6/4 22:27:52  ******/  2 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Manager]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)  3 drop table [dbo].[Manager]  4 GO  5   6 /****** Object:  Table [dbo].[Manager]    Script Date: 2014/6/4 22:27:52   ******/  7 CREATE TABLE [dbo].[Manager] (  8   [Id] [int] IDENTITY (1, 1) NOT NULL,  9   [LoginName] [nvarchar] (20) NOT NULL, 10   [LoginPass] [nvarchar] (32) NOT NULL, 11   [LoginTime] [datetime] NOT NULL, 12   [LoginIp] [nvarchar] (30) NOT NULL, 13   [LoginCount] [int] NOT NULL, 14   [CreateTime] [datetime] NOT NULL, 15   [UpdateTime] [datetime] NOT NULL, 16   [IsMultiUser] [tinyint] NOT NULL, 17   [Branch_Id] [int] NOT NULL, 18   [Branch_Code] [nvarchar] (20) NOT NULL, 19   [Branch_Name] [nvarchar] (25) NOT NULL, 20   [Position_Id] [nvarchar] (100) NOT NULL, 21   [Position_Name] [nvarchar] (30) NOT NULL, 22   [IsWork] [tinyint] NOT NULL, 23   [IsEnable] [tinyint] NOT NULL, 24   [CName] [nvarchar] (20) NOT NULL, 25   [EName] [nvarchar] (50) NOT NULL, 26   [PhotoImg] [nvarchar] (250) NOT NULL, 27   [Sex] [nvarchar] (4) NOT NULL, 28   [Birthday] [nvarchar] (20) NOT NULL, 29   [NativePlace] [nvarchar] (100) NOT NULL, 30   [NationalName] [nvarchar] (50) NOT NULL, 31   [Record] [nvarchar] (25) NOT NULL, 32   [GraduateCollege] [nvarchar] (30) NOT NULL, 33   [GraduateSpecialty] [nvarchar] (50) NOT NULL, 34   [Tel] [nvarchar] (30) NOT NULL, 35   [Mobile] [nvarchar] (30) NOT NULL, 36   [Email] [nvarchar] (50) NOT NULL, 37   [QQ] [nvarchar] (30) NOT NULL, 38   [Msn] [nvarchar] (30) NOT NULL, 39   [Address] [nvarchar] (100) NOT NULL, 40   [Content] [ntext] NOT NULL, 41   [Manager_Id] [int] NOT NULL, 42   [Manager_CName] [nvarchar] (20) NOT NULL 43 ) ON [PRIMARY] 44 GO 45  46 ALTER TABLE [dbo].[Manager] WITH NOCHECK ADD 47   CONSTRAINT [PK_Manager] PRIMARY KEY  CLUSTERED 48 ( 49  [Id] 50 )  ON [PRIMARY] 51 GO 52  53 ALTER TABLE [dbo].[Manager] ADD 54   CONSTRAINT [DF_Manager_LoginName] DEFAULT ('') FOR [LoginName], 55   CONSTRAINT [DF_Manager_LoginPass] DEFAULT ('') FOR [LoginPass], 56   CONSTRAINT [DF_Manager_LoginTime] DEFAULT (getdate()) FOR [LoginTime], 57   CONSTRAINT [DF_Manager_LoginIp] DEFAULT ('') FOR [LoginIp], 58   CONSTRAINT [DF_Manager_LoginCount] DEFAULT (0) FOR [LoginCount], 59   CONSTRAINT [DF_Manager_CreateTime] DEFAULT (getdate()) FOR [CreateTime], 60   CONSTRAINT [DF_Manager_UpdateTime] DEFAULT (getdate()) FOR [UpdateTime], 61   CONSTRAINT [DF_Manager_IsMultiUser] DEFAULT (0) FOR [IsMultiUser], 62   CONSTRAINT [DF_Manager_Branch_Id] DEFAULT (0) FOR [Branch_Id], 63   CONSTRAINT [DF_Manager_Branch_Code] DEFAULT ('') FOR [Branch_Code], 64   CONSTRAINT [DF_Manager_Branch_Name] DEFAULT ('') FOR [Branch_Name], 65   CONSTRAINT [DF_Manager_Position_Id] DEFAULT ('') FOR [Position_Id], 66   CONSTRAINT [DF_Manager_Position_Name] DEFAULT ('') FOR [Position_Name], 67   CONSTRAINT [DF_Manager_IsWork] DEFAULT (0) FOR [IsWork], 68   CONSTRAINT [DF_Manager_IsEnable] DEFAULT (1) FOR [IsEnable], 69   CONSTRAINT [DF_Manager_CName] DEFAULT ('') FOR [CName], 70   CONSTRAINT [DF_Manager_EName] DEFAULT ('') FOR [EName], 71   CONSTRAINT [DF_Manager_PhotoImg] DEFAULT ('') FOR [PhotoImg], 72   CONSTRAINT [DF_Manager_Sex] DEFAULT ('') FOR [Sex], 73   CONSTRAINT [DF_Manager_Birthday] DEFAULT ('') FOR [Birthday], 74   CONSTRAINT [DF_Manager_NativePlace] DEFAULT ('') FOR [NativePlace], 75   CONSTRAINT [DF_Manager_NationalName] DEFAULT ('') FOR [NationalName], 76   CONSTRAINT [DF_Manager_Record] DEFAULT ('') FOR [Record], 77   CONSTRAINT [DF_Manager_GraduateCollege] DEFAULT ('') FOR [GraduateCollege], 78   CONSTRAINT [D
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 敖汉旗| 远安县| 宜兰县| 河间市| 额尔古纳市| 凤冈县| 凤山县| 鹤庆县| 观塘区| 阜康市| 东乡县| 玉田县| 山西省| 甘德县| 同心县| 沁阳市| 泰顺县| 临洮县| 东明县| 民乐县| 金坛市| 明光市| 墨江| 苗栗县| 东光县| 宝山区| 利津县| 会泽县| 拜泉县| 伊金霍洛旗| 弥勒县| 隆昌县| 宁化县| 临西县| 金阳县| 兰西县| 杂多县| 谢通门县| 杂多县| 杂多县| 新蔡县|