程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> 關於ASP.NET >> asp.net身份驗證和授權

asp.net身份驗證和授權

編輯:關於ASP.NET

今天閒著無聊.想起來了ASP.NET身份驗證.感覺良好.貼出下列代碼:

login.aspx HTML代碼

1<%@ Page language="c#" Codebehind="02Login.aspx.cs" AutoEventWireup="false" Inherits="身份驗證._02Login" %>
2<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
3<HTML>
4  <HEAD>
5    <title>02Login</title>
6    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
7    <meta name="CODE_LANGUAGE" Content="C#">
8    <meta name="vs_defaultClientScript" content="JavaScript">
9    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
10  </HEAD>
11  <body MS_POSITIONING="GridLayout">
12    <form id="Form1" method="post" runat="server">
13      <FONT face="宋體">
14        <TABLE id="Table1" style="Z-INDEX: 102; LEFT: 152px; WIDTH: 446px; POSITION: absolute; TOP: 80px; HEIGHT: 72px"
15          cellSpacing="1" cellPadding="1" width="446" border="1">
16          <TR>
17            <TD>
18              <asp:label id="Label1" runat="server">用戶名稱:</asp:label></TD>
19            <TD>
20              <asp:textbox id="tbName" runat="server" Width="183px"></asp:textbox></TD>
21            <TD>
22              <asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" ErrorMessage="用戶名不能為空!" ControlToValidate="tbName"></asp:requiredfieldvalidator></TD>
23          </TR>
24          <TR>
25            <TD>
26              <asp:label id="Label2" runat="server">密碼:</asp:label></TD>
27            <TD>
28              <asp:textbox id="tbPass" runat="server" Width="183px"></asp:textbox></TD>
29            <TD>
30              <asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" ErrorMessage="密碼不能為空!" ControlToValidate="tbPass"></asp:requiredfieldvalidator></TD>
31          </TR>
32          <TR>
33            <TD><FONT face="宋體">是否保存Cookie</FONT></TD>
34            <TD>
35              <asp:checkbox id="PersistCookie" runat="server"></asp:checkbox></TD>
36            <TD></TD>
37          </TR>
38        </TABLE>
39        <asp:button id="btnLoginBetter" style="Z-INDEX: 101; LEFT: 288px; POSITION: absolute; TOP: 240px"
40          runat="server" Width="78px" Text="登錄"></asp:button>
41        <asp:HyperLink id="HyperLink1" style="Z-INDEX: 103; LEFT: 456px; POSITION: absolute; TOP: 240px"
42          runat="server" NavigateUrl="Default.aspx">HyperLink</asp:HyperLink></FONT>
43    </form>
44  </body>
45</HTML>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved