|
-
Mar 12th, 2010, 09:15 AM
#1
Thread Starter
Frenzied Member
Getting cookies data
I have an application where I use the standard login controls from VS 2005.
I have a problem, how do I get the user info if the user has marked the checkbox "remember me"?
In my application I load the username, when the user is logging in, that is the textbox named Login1.LayoutTemplate.UserName
How do I get the data when the user automatically is logged in and doesn't enter the user name?
-
Mar 13th, 2010, 04:27 AM
#2
Re: Getting cookies data
Hey,
You should be able to use:
Code:
HttpContext.Current.User.Identity.Name
I haven't got Visual Studio open in front of me just now, but you should be able to shorten the above to:
If I remember correctly, but you would need to check.
Gary
-
Mar 13th, 2010, 06:58 AM
#3
Hyperactive Member
Re: Getting cookies data
 Originally Posted by gep13
Hey,
Code:
HttpContext.Current.User.Identity.Name
I haven't got Visual Studio open in front of me just now, but you should be able to shorten the above to:
Gary
i've checked that...
Remember Me option Doesn't Remember Me....
even if i use
Code:
FormsAuthentication.RedirectFromLoginPage(UserName.Text,true);
i mean once u close the browser...
you are logged out...!
so any help on this..?
-
Mar 13th, 2010, 07:08 AM
#4
Re: Getting cookies data
Hey,
I was referring to the use of the ASP.Net Membership Provider, not a self implemented "Remember Me", is this what you are referring to?
Gary
-
Mar 13th, 2010, 07:36 AM
#5
Hyperactive Member
Re: Getting cookies data
Yes i mean
Code:
if(Membership.ValidateUser(UserName,Passoword))
FormsAuthentication.RedirectFromLoginPage(UserName.Text,true);
also instead of this if i write my own custom logic then..it would be
Code:
if(UserName == DatabaseUserName && Password == DataBasePassword)
{
FormsAuthentication.RedirectFromLoginPage(UserName.Text,true);
}
In bothe case Remember Me i've Kept true.
so the persistent cookie will be created but...
it does not Remember...!
-
Mar 13th, 2010, 08:00 AM
#6
Re: Getting cookies data
Hey,
Which browser are you testing this with? Are cookies enabled?
Gary
-
Mar 13th, 2010, 08:16 AM
#7
Hyperactive Member
Re: Getting cookies data
yup...cookies heavily enabled
now u tell me...according to you wot should happen..?
am i missing any procedure...?
or you u tell me hw should i proceed..!
-
Mar 13th, 2010, 08:26 AM
#8
Re: Getting cookies data
Hey,
First of all, I would be checking your cookies to make sure that a cookie has been created. If required, I would call the other overload for the RedirectFromLoginPage to include a path to the cookie:
http://msdn.microsoft.com/en-us/library/1f5z1yty.aspx
From there, I would ask, how are you verifying that the "Remember Me" functionality isn't working?
Gary
-
Mar 16th, 2010, 05:18 AM
#9
Thread Starter
Frenzied Member
Re: Getting cookies data
You can try to validate the user using
Dim usern As MembershipUser = Membership.GetUser()
I think the problem is can be caused by the session timeout, please try to set your session timeout to 100000 in your webconfig just for testing this
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|