Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 1st, 2004, 12:16 PM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default Remember the UserName and Password

Hello,

 Please can anyone tell me how to implement the remember me feature (through a checkbox control) in the Login page?
Thanks,
Marenela

 
Old October 1st, 2004, 10:48 PM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is 'my' code for the login.aspx.cs file. It sets the cookie that remembers the User. Just add a checkbox to the login.aspx page and check it's value before setting the cookie.
Code:
private void Submit_Click(object sender, System.EventArgs e)
{            
 SkiPrincipal newUser = SkiPrincipal.ValidateLogin( EmailAddress.Text.Trim(),   Password.Text.Trim() );

 if (newUser == null)
 {
  LoginResult.Text = "Login failed for " + EmailAddress.Text;
  LoginResult.Visible = true;
 }
else 
 {
  Context.User = newUser;
  if(chkRememberMe.Checked)
  {
  FormsAuthentication.SetAuthCookie( EmailAddress.Text, true );
  }
  Response.Redirect("/ThePhileCS/default.aspx");
  }
}
 
Old October 2nd, 2004, 02:01 AM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
Remember my id & password tanzi Servlets 1 May 8th, 2008 10:20 PM
Regarding Username and password kuku_ashu Javascript How-To 0 January 4th, 2008 11:28 AM
username and password abhi_loveu2002 ASP.NET 2.0 Basics 1 December 14th, 2006 05:25 AM
Simple cookie to remember userid and password Dayzed Classic ASP Basics 1 April 14th, 2004 08:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.