Cookies?

U

UJ

I am doing the following code using cookies but the cookies never seem to being set. Is there more I need to do? Is there some web.config option I need to change?

Here's the code:

On page load:

If Not IsPostBack Then
Dim cookLastLogin As HttpCookie
cookLastLogin = Response.Cookies("LastLogin")
if Not cookLastLogin.Value Is Nothing Then
Me.txtUserName.Text = cookLastLogin.Value
End If
End If


After the person has clicked my login button I do:

If Me.cbRememberMe.Checked Then
Response.Cookies("RememberMe").Value = "Y"
Response.Cookies("LastLogin").Value = txtUserName.Text
Response.Cookies("LastLogin").Expires = DateTime.Now.AddYears(30)
Else
Response.Cookies("RememberMe").Value = "N"
Response.Cookies("LastLogin").Value = txtUserName.Text
Response.Cookies("LastLogin").Expires = DateTime.Now.AddYears(-1)
End If

Response.Cookies("RememberMe").Expires = DateTime.Now.AddYears(30)


The values for LastLogin don't appear to ever be saved.

TIA - J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

No-Postback Reload Causing Duplicates :( 0
Cookies Count 2
cookie trouble 3
Cookie Basics 1
What is the proper way to use cookies? 1
ASP.NET 2.0 Cookies 1
Page refresh question 2
How to clear cookies in ASP? 6

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top