How are cookies named when stored on a client machine?

V

Vince C.

Hi.

I'm trying to work with cookies from ASP and I've noticed cookies are stored on
my machine in two distinct forms. the first form is "Cookie:<user name>@<web
site>", which is a combination between my current logon ID and the visited web.
The second is "<name>".

I get the second form when I send a cookie from ASP script using the following
instructions:

<%@ Language=JavaScript %>
<%
function setCookie( szName, szValue )
{
Response.Cookies(szName).Item = szValue;
Response.Cookies(szName).Expires = "10/10/2004";
}
....
%>

The value in szName becomes the cookie name. Note however the cookie *address*
is like any others: "Cookie:<user name>@<web site>".

How did I get those cookies in the first form? Is the second form IIS-specific?

Thanks,
Vince C.
 
M

MSFT

Hi Vince,

Different browsers store cookies in different ways. Internet Explorer
stores the cookies for a site in a file whose name is in the format
<user>@<domain>.txt, where <user> is your account name. For example, if
your name is mikepope and you visit the site www.contoso.com, the cookies
for that site will be in a file called (e-mail address removed). (The name
might include a sequential number, such as (e-mail address removed)[1].txt.)
The cookie text files are user-specific, so they are isolated by account.

regarding the question, I think you first need ensure your logon as windows
account to that IE can found the user name and web site.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
V

Vince C.

MSFT said:
Hi Vince,

Different browsers store cookies in different ways. Internet Explorer
stores the cookies for a site in a file whose name is in the format
<user>@<domain>.txt, where <user> is your account name. For example, if
your name is mikepope and you visit the site www.contoso.com, the cookies
for that site will be in a file called (e-mail address removed). (The name
might include a sequential number, such as (e-mail address removed)[1].txt.)
The cookie text files are user-specific, so they are isolated by account.

regarding the question, I think you first need ensure your logon as windows
account to that IE can found the user name and web site.

Thanks, Luke.

However I was mistaken when I described the second form. Instead of "<name>" I
should have written "<folder>". For instance, I created a web application on my
machine; when I browse http://localhost/webfolder and there is a cookie
involved, it is named "/webfolder" instead of "Cookie:<logon name>@localhost".

I'd like to know why and when cookies are named differently. I mean the name
that is displayed when you browse your temporary Internet files folder and use
"Details" as a display mode. My cookie *file* name has the same syntax as the
others but the *name* of the cookie is different. So I was not talking about the
file name.

To make it short why and when do I have cookie names like "/webfolder" and
others like "Cookie:[email protected]"?

Vince C.
 
M

MSFT

Hi Vince,

Cookie has the "path" property. If you put the asp file in "/AppName", the
cookie will be like

User@AppName

If you put it in the wwwroot folder, it will be like

User@localhost

or

User@ComputerName

If your web server has a domain name like "www.mydomain.com", it will be:

(e-mail address removed)

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
V

Vince C.

MSFT said:
Hi Vince,

Cookie has the "path" property. If you put the asp file in "/AppName", the
cookie will be like

User@AppName

If you put it in the wwwroot folder, it will be like

User@localhost

or

User@ComputerName

If your web server has a domain name like "www.mydomain.com", it will be:

(e-mail address removed)

Luke
Microsoft Online Support

Thanks a lot, Luke.

Vince C.
 

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,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top