Iowa Web Network

Just another WordPress site
  • Home
  • ASP.NET
  • Classic ASP
  • CSS
  • Contact
  • .NET 4.0
  • Applications
    • Access
    • ASP.NET
      • Controls
      • Date and Time Format
      • Email
      • Survey Form
      • Validation Controls
      • VS2010
    • Encryption
    • jQuery
    • System Info
  • Articles
  • Classic ASP
  • Classified
  • Css
  • Error
    • application error
    • application pool
    • system error
  • HTML
  • Images
  • JavaScript
  • MS SQL
  • Networking
    • Wi-Fi
  • SQL
  • UNC
  • VS2012
Home » Applications » Login

Login

December 27, 2010 - Posted in Applications, ASP.NET

~ Simple login application ~

Web.config

<system.web>

<authentication mode=”Forms”>

<forms loginUrl=”~/ Login.aspx” timeout=”2880″/>

</authentication>

</system.web>

Login.aspx

<asp:Label ID=”UserNameLabel” runat=”server” AssociatedControlID=”UserName”>User Name:</asp:Label>

<asp:TextBox ID=”UserName” runat=”server”></asp:TextBox>

<asp:RequiredFieldValidator ID=”UserNameRequired” runat=”server”
ControlToValidate=”UserName” ErrorMessage=”User Name is required.”
ToolTip=”User Name is required.” ValidationGroup=”Login1″>*
</asp:RequiredFieldValidator>

<asp:Label ID=”PasswordLabel” runat=”server” AssociatedControlID=”Password”>Password:</asp:Label>

<asp:TextBox ID=”Password” runat=”server” TextMode=”Password”></asp:TextBox>

<asp:RequiredFieldValidator ID=”PasswordRequired” runat=”server”
ControlToValidate=”Password” ErrorMessage=”Password is required.”
ToolTip=”Password is required.” ValidationGroup=”Login1″>*</asp:RequiredFieldValidator>

<asp:Literal ID=”FailureText” runat=”server” EnableViewState=”False”></asp:Literal>

<asp:Button ID=”LoginButton” runat=”server” CommandName=”Login” Text=”Log In” ValidationGroup=”Login1″ />

Login.aspx.vb

Partial Class Login
Inherits System.Web.UI.Page

Function SiteSpecificAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean
‘ Insert code that implements a site-specific custom
‘ authentication method here.
If UserName = “YourUsn” And Password = “YourPwd” Then
Response.Redirect(“YourPage.aspx”)
End If
‘ This example implementation always returns false.
Return False
End Function

Sub OnAuthenticate(ByVal sender As Object, ByVal e As AuthenticateEventArgs)
Dim Authenticated As Boolean
Authenticated = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)

e.Authenticated = Authenticated
End Sub

End Class

Tags: ASP.NET, Login, Visual Studio

« Classified
Login »
  • Posts by Date

    December 2010
    M T W T F S S
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
        Jan »
  • Recent Posts

    • ASP.NET (C#) – Session Info – Count Clicks
    • ASP.NET (VB) File Upload with Delete
    • ASP.NET (VB) – Multiple Files Upload
    • VB.NET – User Impersonation
    • VB.NET – OleDbConnection Properties
  • Admin Corner

    Login
    Email
  • Post Tags

    Access array ASP.NET bulleted button Calendar characters Classic ASP Colorbox Container.DataItem content Controls Count CSS Date datepicker Email Encryption file Format Form Validation Gridview HTML image Javascript jQuery list Login monitor OleDbConnection Parameters Programming Record update redirect security select session SQL Time total upload uptime Visual Studio web design website

Iowa Web Network is proudly powered by WordPress