views:

35

answers:

3

I have a wierd situation where I have an ASP.NET page that sends the user to the ASP page, and data is passed from one to the other via query string.

I've been assigned the task of changing this so that cookies are used instead of query strings.

I'm a little clueless here. Is this possible? How do I get started? Do I need to worry about anything special because one page is ASP.NET and the other ASP ? I also cannot be totally reliant on Javascript because of those once-in-a-while user visitors who have Javascript turned off.

+2  A: 

This is pretty simple. As long as you are not setting a 'Session Cookie', the cookie is set on the browser.

I'm doing it here...when the user logs in and wants me to remember his username:

Set the cookie in ASP.NET:

Response.Cookies.Add(new HttpCookie("RememberMeUserName", owner.Username));

View the value in ASP:

Response.Write(Request.Cookies("RememberMeUserName"))

Both the ASP.NET & ASP pages must be on the same domain name.

Ed B
+1  A: 

Ed B seems to have it - further reading available here:

http://ryangaraygay.com/blog/post/Updating-ASP-cookie-from-ASPNET-vice-versa.aspx

Dal
A: 

I also found this : http://www.eggheadcafe.com/tutorials/aspnet/198ce250-59da-4388-89e5-fce33d725aa7/aspnet-cookies-faq.aspx

With gotcha's concerning IE 6 and fixes! Also has information on how to store multiple values in them.

rlb.usa