?
Solved

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

Posted on 2011-03-15
3
Medium Priority
?
553 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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