Cookie Basics

G

Greg Smith

I am learning to create cookies. When I do something like this:

Response.Cookies["Username"].Value = "fred";

Response.Cookies["Username"].Expires = DateTime.Now.AddYears(30);



I get a cookie with the name of the host in it, i.e.. greg@localhost or
greg@myServerDNS.

I would like to give it a specific name. Is there a way to do so?





Any help is greatly appreciated.
 
G

Guest

Hi Greg,

See the examples here:
http://www.codetoad.com/asp.net/cookies.asp

If you are making apps with ASP.NET, and using cookies to persist (remember)
values in parts of your app, ASP.NET's "Viewstate" feature can substitute
for cookies in many instances. ASP.NET has a bunch of other mechanisms for
persisting state that aren't a part of other application frameworks like
Classic ASP or PHP. Google around on "state management ASP.NET" if you're
interested.

-KF
 

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

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,228
Latest member
MikeMichal

Latest Threads

Top