.NET Framework
Using Cookie in ASP.NET
Y2K
2009. 1. 7. 13:07
A cookie is stored on the client's machine by their web browser software. To set a cookie, we include information in an HttpResponse that instructs the browser to save a cookie on the client's system. Here's the basic code for writing a Cookie in ASP.NET
|
And to read the cookie back :
|
Note that for security reasons you can only read a cookie that was set within the same domain name.
Sometimes you may need a collection of stored items, such as user address details. In this case you could read in a cookie collection like this:
|