Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
I am creating a login from in C#.net windows application and i have a remember me checkbox in the login page. can give me a code the remember me check box in the C# windows application
Posted 18-Feb-13 21:26pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Well if you want to introduce remember Me checkbox (Most of the time we implement it in Web applications) you take decision that where you store that information. You can store it to client pc. In client side you can store it to any text/xml file or windows registry which you prefer with encrypted way. When user open windows executable file, Login page load event check location that any remeber be data is exists or not to a specific location. If so then it read that data and assign that to the login page userid/password textbox and checked remember me checkbox. If anyone uncheck remember be checkbox and click login button that time first it delete remember be information from client location(file/registry).Psedo code like
 
LoginForm_Load(object sender, EventArgs e)
{
    RememberMe remember= Helper.GetRememberMe();
    If (null != remember)
    {
       txtUserId = remeber.UserId;
       txtPassword = remember.Password;
       chkRememberMe.Checked=true;
    }
}
 
btnLogin_Click(object sender, EventArgs e)
{
   if(chkRememberMe.Checked)
   {
       var remember = new RememberMe{UserId = txtUserId.Text, Password=txtPassword.Text};
       Helper.SaveRememberMe(remeber);
    }
    else
    {
       Helper.ForgetMe();   
    }
}
 
You just need to implement Helper class where GetRememberMe, ForgetMe functionality api will be there.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150302.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100