Blue Theme Orange Theme Green Theme Red Theme
 
Team Foundation Server Hosting
Home | Forums | ASP.NET 2.0 Tutorials | Web Services | How Do I...? | Class Browser | WPF Quick Starts | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
6 Months Free & No Setup Fees ASP.NET Hosting!
Search :       Advanced Search »
Home » ASP.NET 2.0/3.5 » Login Control in ASP.NET 2.0

Login Control in ASP.NET 2.0

In this article you will found the knowledge of LoginControl with example in ASP.NET 2.0. You will also see that How the LoginControls are use?

Author Rank :
Page Views : 44794
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Overview of Login Control:

 

The Login control provides the user interface to log a user into a web site. The Login control uses the Membership service to authenticate the user in your membership system. The default Membership service from your configuration file will be used automatically, however you can also set the Membership provider that you would like used as a property on the control. The Login Control consists of:

 

Username Label and Textbox: Collects the string used to identify the user in the membership system.

 

Password Label and Textbox: Collects the password for the specified user. The textbox text is always obscured.

 

LoginButton: The button to submit the users request for authentication.

 

RememberMe: Configurable to display a checkbox giving the user the option to store a persistent cookie on the user's machine.

 

Title and Instruction: Text to orient and guide the user through the process.

 

Links: Configurable links to help, password recovery and user registration information.

 

Validators: Required field Validators for the username and password textboxes.

The following figure represents the login control.

 

 

 

Figure 1: Login control in toolbox.

 

Login controls in ASP.NET 2.0: There are the following login controls in ASP.NET 2.0.

  • Login
  • LoginView
  • PasswordRecovery
  • LoginStatus
  • LoginName
  • ChangeUserWizard
  • ChangePassword

Login control:

 

Login control provides the server side functionality that is useful and does not warrant adaptation. So, the goal of the Login control's adapter is to improve the markup used in the form's presentation without touching the serverside functionality.

 

The Login control presents a simple HTML form for gathering user credentials. When submitted, the web server's Membership Provider determines if the credentials are valid correct and valid.

 

For Example:

 

<asp:Login ID="Login1" runat="server" BackColor="#FFFF80" BorderColor="Red">

</asp:Login >

 

The designing part of this source code is as follows:

 

 

Figure 2: Login control.

 

In the login control Use the following values when filling out the login form.

 

User Name = puru

 

Password = rathore

 

If your user name and password are correct, you'll be taken to a page that demonstrates the LoginStatus control.

 

Note: Please note that the login form does not display if the user is already logged in.

LoginView:

The LoginView control automatically detects a user's authentication status and role and matches that information to appropriate template of information to display to that user.

 

The LoginView control consists of a collection of templates that can be associated with an authentication status or one or more role groups.

 

It supports a collection of templates associated with different user roles. Since a user can be associated with multiple roles and a template can be associated with multiple roles it is important to understand how the template is matched to the user's role.

 

PasswordRecovery:

 

The PasswordRecovery control provides the functionality to retrieve or reset a user's password based on their user name. The information is then emailed to the user. The control does not support displaying the password to the user in their web browser.

It may be possible for the email containing the user's password to be intercepted by hackers and thus compromise the users account.

 

The PasswordRecovery control uses the Membership service retrieve or reset the user's password.

 

BackColor="#FFFF80" BorderColor="Blue"

<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"    Height="156px" Width="298px">

</asp:PasswordRecovery>

 

User can recover the password by this control when he forgets the password. PasswordRecovery control looks as follows-

 

 

Figure 3: PasswordRecovery Control.

 

LoginStatus:

 

If the user is logged in, the logout link is displayed. Otherwise, the login link is shown. In both cases, the link goes to the login page.

 

For Example:

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>LoginStatus Control</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:LoginStatus ID="LoginStatus1" runat="server" BackColor="Yellow" BorderColor="Blue"ForeColor="Blue" Height="50px" Width="181px" />

    </div>

    </form>

</body>

</html>

 

The designing part of this source code is as follows:

 

 

Figure 4: LoginStatus Control. 

 

LoginName:

 

The LoginName control displays the currently authenticated users name on the page. It uses the value returned by calling page.user.identity.

 

If the user is not currently logged in then the control does not render on the page and does not hold any visual space on the page.

 

The LoginName control supports the standard web control style properties to control its display.

 

For Example:

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>LoginName Control</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:LoginName ID="LoginName1" runat="server" BackColor="Yellow" BorderColor="DodgerBlue" Height="86px" Width="227px" />

    </div>

    </form>

</body>

</html>

 

The designing part of this source code is as follows:

 

 

Figure 5: LoginName Control.

 

CreateUserWizard:

 

The CreateUserWizard control is a kind of CompositeControl like the other ASP.NET Membership controls.

 

Use the following values when filling out the CreateUserWizard form.

 

User Name = puru 

 

Password and Confirm Password = rathore

(It doesn't matter what you type for the email and the security question and answer.)

 

When you click the "continue" button on the "Complete" page, you'll be taken to a page that demonstrates the LoginStatus control.

 

For Example:

 

<body text="#000000" bgcolor="#ffffff" link="#ff66ff">

    <form id="form1" runat="server">

    <div>

        <asp:CreateUserWizard ID="CreateUserWizard1" runat="server"   BackColor="#FFFF80"BorderColor="Blue">

            <WizardSteps>

              <asp:CreateUserWizardStep runat="server">

                </asp:CreateUserWizardStep>

                <asp:CompleteWizardStep runat="server">

                </asp:CompleteWizardStep>

            </WizardSteps>

        </asp:CreateUserWizard>

    </div>

    </form>

</body>

 

The designing part of this source code is as follows:

 

 

Figure 6: CreateUserWizard Control.

 

ChangePassword:

 

If user wants to change his password then he uses this control. To changing the password the following values need to filling.

 

User name = puru

 

Old password = rathore

 

New password = (user can use anything that ha want for example abcd)

 

Retype new password = (type the same new password for example abcd)

 

For Example:

 

<body text="#000000" bgcolor="#ffffff" link="#ff66ff">

    <form id="form1" runat="server">

    <div>

        <asp:ChangePassword ID="ChangePassword1" runat="server" BackColor="#FFFF80" BorderColor="Blue" ForeColor="Fuchsia" Width="412px">

        </asp:ChangePassword>

    </div>

    </form>

</body>

 

The designing part of this source code is as follows:

 

 

 

Figure 7: ChangePassword Control.

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Purushottam Rathore

I am working as a Software Developer and has 4 years of experience on Microsoft Technology and having a Master Degree in Computer Application. I really like to work in the .NET platform. and working with ASP.NET 2.0/3.5, Web Services, WPF, WCF, Silverlight, AJAX, JavaScript, JQuery, Ado.net, MsAccess, SQL Server 2005/2008.

Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
hai by raja On May 18, 2010
i need an login control and its specification settings

Reply | Email | Modify 
login control by Munna On May 21, 2010
give me example of login in asp with coding..
Reply | Email | Modify 
Re: Login control in ASP.Net by Guggi On September 12, 2011
great!!!!!!!!! this is good one, you can check out the following links for more details..... http://www.mindstick.com/Articles/1bd75404-424e-4c84-ab55-28742117d6ad/?Login%20Control%20in%20ASP.Net
Reply | Email | Modify 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.