Authentification in ASP.NET Animated with a Progress Bar

Authentification in ASP.NET Animated with a Progress Bar

Its an easy way in order to login into webpages using the login control in and the membership provider animated with a progress bar.

In the Parsing Xml side, we add a login control and an update progress bar

<asp:ScriptManager ID="ScriptManager1" runat="server">
    <asp:UpdatePanel id="UpdatePanel1" runat="server">
        <asp:Login ID="Login1" runat="server"
            style="Z-INDEX: 110; LEFT: 350px; POSITION: absolute; TOP: 100px"
            BackColor="White" BorderColor="#F1F6FE" BorderPadding="4" BorderStyle="Solid"
            BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333"
            Height="140px" Width="340px"
      UserNameLabelText="ID:" DestinationPageUrl="Welcome.aspx">
      <LoginButtonStyle BackColor="White" BorderColor="#41519A" BorderStyle="Solid" BorderWidth="1px"
        Font-Size="0.8em" ForeColor="#41519A" />
    <TextBoxStyle Font-Size="0.8em" />
    <TitleTextStyle BackColor="#2153AA" Font-Bold="True" Font-Size="0.8em" ForeColor="White" />
    <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
<asp:UpdateProgress ID="UpdateProgress1" runat="server" >
                 <img src="images/loadingAnim.gif"  style="Z-INDEX: 110; LEFT: 400px; POSITION: absolute; TOP: 300px"/>

In the code behind using we use the membership provider generated by the visual studio to securise our website.

We add a sleeping thread of 3 second in the event Login1_LoggingIn to let the progress bar show some animation.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       If Not Page.IsPostBack Then
           If Request.IsAuthenticated AndAlso Not String.IsNullOrEmpty(Request.QueryString("ReturnUrl")) Then
           End If
       End If
   End Sub
   Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
       If Membership.ValidateUser(Login1.UserName, Login1.Password) Then
           Dim usrInfo As MembershipUser = Membership.GetUser(Login1.UserName)
           e.Authenticated = True
           e.Authenticated = False
       End If
   End Sub
   Protected Sub Login1_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoginError
       Login1.FailureText = Resources.traduction.failureText
   End Sub
   Protected Sub Login1_LoggingIn(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs) Handles Login1.LoggingIn
   End Sub
Leave a Comment
  • Please add 4 and 7 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Page 1 of 1 (1 items)
Wikis - Comment List
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
  • Ed Price - MSFT edited Original. Comment: Tags

  • Thanks, I like your code

Page 1 of 1 (2 items)