ASP.NET Cookies for an ASP Page

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

I was tasked with changing this so that cookies are used instead of query strings.

I am a little clueless. Is it possible? How do i get started? Do I need to worry about anything special because one page is ASP.NET and another ASP? I also cannot completely rely on Javascript because of those who at that time were visitors to users who had Javascript disabled.

+4
source share
3 answers

It is pretty simple. Until you set a session cookie, the cookie is set in the browser.

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

Set cookie in ASP.NET:

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

View value in ASP:

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

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

+3
source

Ed B seems to have it - here you can read the following:

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

+1
source

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

With gotcha regarding IE 6 and fixes! There is also information on how to store several values ​​in them.

0
source

Source: https://habr.com/ru/post/1314124/


All Articles