views:

43

answers:

1

Hi everyone, I need your help

I've a MVC project that uses Jquery, where I've implemented a mechanism of "Remember Me" using cookies to save, clear and retrieve the login and password.

I also have two screens where the user does the login. I want that both logins manipulate the same cookie. I've got to implement it, but I've realized that each one has a different behaviour. I mean, the cookie's value I save in the first login is not the same than the value that retrieves the second login (when I open it). In other words, if I mark "remind me" on the first login, it isn't reflected on the second login and viceversa. What can I do to make that both of them manipulate and read the same values from the same cookie? Is it possible?

PS: For this situations I'm using the same web navigator: Firefox or IE.

Thanks in advance

A: 

Cookies are specific to the domain that creates them. If you are having two login screens,you need to have them under the same domain ( some thing like login.yourdomain.com if you have more than one domain)

Sri

schar
Thanks for the information, I didn't know that, but in this situation both logins are under the same domain. The same behaviour happens when I open the same login screen in different navigators. Seems like the cookie was handled independently.
cer9ss
Cookie is specific to Domain and Browser. You can never access a cookie set in IE from Firefox.
schar
Fine, I understand the part of the browsers. About the domain, this means that if I have only one cookie for two login URLs like these "http://companyname/login" and a "http://companyname/main/login" they won't be able to access to the same cookie?
cer9ss
Try setting the Cookie path and see if that solves the problem. http://stackoverflow.com/questions/576535/cookie-path-and-its-accessibility-to-subfolder-pages
schar