Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-15
3
Medium Priority
?
565 Views
Last Modified: 2012-05-11
Hi,
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 ASP.net 2.0,C#
0
Comment
Question by:kishan66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 

Author Comment

by:kishan66
ID: 35140267
FYI,

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.Cookies.Add(authCookie);
                    Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUserName.Text, false));
}

Open in new window

0
 

Accepted Solution

by:
kishan66 earned 0 total points
ID: 35142791
Thank you for not Responding to my question.

I figured it out by using Cookies again.
0
 

Author Closing Comment

by:kishan66
ID: 35142815
(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.
 Response.Cookies.Add(aCookie);
In the page load ()
 if (Request.Cookies["user"] != null)
                Login1.UserName = Server.HtmlEncode(Request.Cookies["user"].Value);  

Thats it ...
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Screencast - Getting to Know the Pipeline
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question