i use this code for implement the remember me (to icrease the duration that a client is authenticated) Code: FormsAuthentication.Initialize() Dim expires As DateTime = DateTime.Now.AddDays(20) Dim ticket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, tbox_username.Text, DateTime.Now, expires, True, String.Empty, FormsAuthentication.FormsCookiePath) Dim encryptedTicket As String = FormsAuthentication.Encrypt(ticket) Dim authCookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) authCookie.Expires = expires Response.Cookies.Add(authCookie) but although it works in my visual studio it doesnt work in the server any idea why??
By "doesn't work in the server", what exactly do you mean? Is it just not working at all, or getting logged out after a bit?
sory you are right i must be more accurate the problem is that is as it doesnt exist this code in my localhost by visual studio with this code the coockies duration is 20 days in the discountasp.net host the coockie expires very soon i think about 20-30 minutes
If you are looking to hold your sessions longer I would recommend looking into SQL session state. https://support.discountasp.net/KB/...er-session-on-your-web.aspx?KBSearchID=195766 This will make sure your sessions are not lost even after the application pool recycles.
but this is for the coockies not for the sessions i think that the coockies go to the clients pc and the sessions have to do with the server or they have some similarities in the way that they are handled from the server??
Well, like you said, the cookie is in the user's browser, so when it expires is unrelated to anything happening on the server. Are you sure you aren't sending the cookie more than once? It's possible that you try to send the cookie a second time and it is overwriting the first instance, which could, theoretically, kill anything under the first cookie...just a thought. Otherwise the cookie expiration is happening due to something client-side.
yes i am surte because it works in my localhost from my visual studio the problem is in the online page that is hosted on discountasp.net
Sessions dont get lost on your local machine. So the comparisons are not going to help you resolve your issue. If the application is recycled (on our servers), the session is terminated, the user is no longer authenticated, the token is no longer valid and the process starts again. Address your session issue and your cookie issue should no longer be a problem.