0

Been banging my head against the wall for the last several hours. What the &^*% am I doing wrong.

Code to set the cookie

Response.Cookies["mydomain-LoginName"].Value = ((Login)sender).UserName;
                        Response.Cookies["mydomain-LoginName"].Expires = DateTime.Now.AddDays(30);

code to read the information back in

strLoginName = Request.Cookies["mydomain-LoginName"].Value;
2
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by f1 fan
0

first try

strLoginName = Server.HTMLEncode(Request.Cookies["mydomain-LoginName"].Value);

Are you not getting anything? Does your browser not accept cookies? Or only from certain paths? If it doesnt you wont get an error. Test with Request.QueryString["AcceptsCookies"] to find out.

0

I finally figured it out. It was the new Login object in asp.net 2.0. It never completes the response, just redirects to another page. Response never ends so cookie never got written.(or something like that) So I just passed it to the page I was redirecting to and had that page write it.

0

oh, it uses its own cookies. Set the expiration etc in the web config. Both sliding and absolute. They have it all built in. If you need the config stuff let me know :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.