ASP.Net/Login Security/Login
Содержание
A formatted Login control
<source lang="csharp">
<asp:Login ID="Login1"
Runat="server" BorderWidth="1px" BorderColor="#cccccc" BorderStyle="Solid" BackColor="#F7F7DE" Font-Names="Verdana" Font-Size="10pt"> <TitleTextStyle Font-Bold="True" BackColor="Navy" ForeColor="#FFFFFF"/>
</asp:Login>
</source>
Forms Security Setup
<A href="http://www.nfex.ru/Code/ASPDownload/FormsSecurity.zip">FormsSecurity.zip( 4 k)</a>
1. <A href="/Code/ASP/Login-Security/ProvidingaloginfortheenduserusingtheLogincontrol.htm">Providing a login for the end user using the Login control</a> 2. <A href="/Code/ASP/Login-Security/AformattedLogincontrol.htm">A formatted Login control</a> 3. <A href="/Code/ASP/Login-Security/TheLoginaspxpageC.htm">The Login.aspx page (C#)</a> 4. <A href="/Code/ASP/Login-Security/TheLoginaspxpageVB.htm">The Login.aspx page (VB)</a> 5. <A href="/Code/ASP/Login-Security/WindowsSecurity.htm">Windows Security</a> <A href="/Code/ASP/Login-Security/WindowsSecurity.htm"></a>
Providing a login for the end user using the Login control
<source lang="csharp">
<%@ Page Language="VB" %>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title>Login Page</title>
</head> <body>
<form id="form1" runat="server"> <asp:Login ID="Login1" Runat="server"> </asp:Login> </form>
</body> </html>
</source>
The Login.aspx page (C#)
<source lang="csharp">
<%@ Page Language="C#"%>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e) { if (TextBox1.Text == "A" && TextBox2.Text == "B") { FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, true); } else { Response.Write("Invalid credentials"); } }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title>Login Page</title>
</head> <body>
<form id="form1" runat="server">
Username
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Password
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
<asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Submit" />
</form>
</body> </html>
</source>
The Login.aspx page (VB)
<source lang="csharp">
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) If (TextBox1.Text = "A" And TextBox2.Text = "B") Then FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, True) Else Response.Write("Invalid credentials") End If End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title>Login Page</title>
</head> <body>
<form id="form1" runat="server">
Username
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Password
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
<asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Submit" />
</form>
</body> </html>
</source>
Windows Security
<A href="http://www.nfex.ru/Code/ASPDownload/WindowsSecurity.zip">WindowsSecurity.zip( 2 k)</a>
1. <A href="/Code/ASP/Login-Security/ProvidingaloginfortheenduserusingtheLogincontrol.htm">Providing a login for the end user using the Login control</a> 2. <A href="/Code/ASP/Login-Security/AformattedLogincontrol.htm">A formatted Login control</a> 3. <A href="/Code/ASP/Login-Security/TheLoginaspxpageC.htm">The Login.aspx page (C#)</a> 4. <A href="/Code/ASP/Login-Security/TheLoginaspxpageVB.htm">The Login.aspx page (VB)</a> 5. <A href="/Code/ASP/Login-Security/FormsSecuritySetup.htm">Forms Security Setup</a> <A href="/Code/ASP/Login-Security/FormsSecuritySetup.htm"></a>