今天闲着无聊.想起来了ASP.NET身份验证.感觉良好.贴出下列代码:
login.aspx HTML代码
<%@ Page language="c#" Codebehind="02Login.aspx.cs" AutoEventWireup="false" Inherits="身份验证._02Login" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>02Login</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="javascript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<TABLE id="Table1" style="Z-INDEX: 102; LEFT: 152px; WIDTH: 446px; POSITION: absolute; TOP: 80px; HEIGHT: 72px"
cellSpacing="1" cellPadding="1" width="446" border="1">
<TR>
<TD>
<asp:label id="Label1" runat="server">用户名称:</asp:label></TD>
<TD>
<asp:textbox id="tbName" runat="server" Width="183px"></asp:textbox></TD>
<TD>
<asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" ErrorMessage="用户名不能为空!" ControlToValidate="tbName"></asp:requiredfieldvalidator></TD>
</TR>
<TR>
<TD>
<asp:label id="Label2" runat="server">密码:</asp:label></TD>
<TD>
<asp:textbox id="tbPass" runat="server" Width="183px"></asp:textbox></TD>
<TD>
<asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" ErrorMessage="密码不能为空!" ControlToValidate="tbPass"></asp:requiredfieldvalidator></TD>
</TR>
<TR>
<TD><FONT face="宋体">是否保存Cookie</FONT></TD>
<TD>
<asp:checkbox id="PersistCookie" runat="server"></asp:checkbox></TD>
<TD></TD>
</TR>
</TABLE>
<asp:button id="btnLoginBetter" style="Z-INDEX: 101; LEFT: 288px; POSITION: absolute; TOP: 240px"
runat="server" Width="78px" Text="登录"></asp:button>
<asp:HyperLink id="HyperLink1" style="Z-INDEX: 103; LEFT: 456px; POSITION: absolute; TOP: 240px"
runat="server" NavigateUrl="Default.aspx">HyperLink</asp:HyperLink></FONT>
</form>
</body>
</HTML>
共3页: 上一页 1 [2]
[3]
下一页