2.0, create Persistant Cookie via code for Login 'Remember me'

I am trying to develop a login page for my website using Login control.
I am not using any Membership(webconfig) to validate the user.

Infact , i am overwriting the OnAuthenticate method of the Login control and Authenticating the user succesfully.

Now, inorder to use the functionality of "Remember me"  check box, How i create the persistant cokkie when ever user selects the "Remember me".
pls advice me ...

Pls Note:- i'm not using any Membership. User details are stored in AD... and im using LDAP to Authenticate ----using 2.0,C#
Who is Participating?
kishan66Connect With a Mentor Author Commented:
Thank you for not Responding to my question.

I figured it out by using Cookies again.
kishan66Author Commented:

i'm creating a cokkie when the user is Authenticated...

now for "Remember me" , do i have to create another cookie with username & password?
pls give me a sample code for the same
if (Authenticated())
   string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                    HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Text, false));

Open in new window

kishan66Author Commented:
(May be not the best Solution) but works.
once Authenticated check for if(Login1.RememberMe) true...then
create cookie for UserName & Password and add it to response object.
In the page load ()
 if (Request.Cookies["user"] != null)
                Login1.UserName = Server.HtmlEncode(Request.Cookies["user"].Value);  

Thats it ...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.