My cookies don't save... Why?

  • Thread starter Thread starter ThunderMusic
  • Start date Start date
T

ThunderMusic

Hi,
I have an application that must save a cookie on the client's machine. I use
this code and it doesn't work. Can someone tell me what's wrong with this
code please?

HttpCookie UserCookie = new HttpCookie("SomeCookieName");
UserCookie.Expires = DateTime.Now.AddYears(5);
UserCookie.Values.Add("UserName", UserName);
UserCookie.Values.Add("Pass", clsPassword.ConvertByteArrayTo0x(Pass));
Request.Cookies.Add(UserCookie);

I don't understand at all. For the last line I also tried
Request.Cookies.Set but didn't work either.

Thanks for the help

ThunderMusic
 
I think you want to set them in the Response instead of the Request.

The Request is what came in from the browser. The Response is what your
server code is sending back to the browser.

- albert
 

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

Back
Top