What you are using is a regular cookie. All the data is stored on the users
computer. Each time the user loads a page on your site, their browser sends
all the cookie data set by your domain to the server (accessible through
the Request.Cookies collection). When you request their username, using
strUsername = Request.Cookies("name"), the server finds the appropriate
value from all the cookie data sent by the browser, and returns it to the
application. See
http://www.w3schools.com/asp/asp_cookies.asp for further
information.
A session cookie is one where all the data is stored on the server (through
the Session object). The only thing stored on the clients computer is an ID
string, so the server knows which user to set / retrieve values for. They
can be set / retrieved using the following code:
Session("name") = strUsername
strUsername = Session("name")
The disadvantage of this is that it takes up server power. It is
recommended that you use it sparingly; regular cookies are best for almost
every situation. A good example of when to use it is if you have a random
code which prevents automated form submission (such as the submission code
at
http://addurl.altavista.com/addurl/new). Obviously, you don't want this
data available to the user through a cookie, but you want it available on
the next page so you can check the correct code was entered. So, you store
it in the Session object.
See
http://www.w3schools.com/asp/asp_sessions.asp for further information.
Hope this helps,
Blair