日期:2010-11-29  浏览次数:20451 次

今天闲着无聊.想起来了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   &nbs