470,618 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,618 developers. It's quick & easy.

How are cookies named when stored on a client machine?

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.
Jul 19 '05 #1
4 4968
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 mi******@www.contoso.txt. (The name
might include a sequential number, such as mi******@www.contoso[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.)

Jul 19 '05 #2
"MSFT" <lu******@online.microsoft.com> a écrit dans le message de
news:%2*****************@cpmsftngxa06.phx.gbl...
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 mi******@www.contoso.txt. (The name
might include a sequential number, such as mi******@www.contoso[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:Vi****@yoursite.com"?

Vince C.
Jul 19 '05 #3
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:

us**@domain.com

Luke
Microsoft Online Support

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

Jul 19 '05 #4
"MSFT" <lu******@online.microsoft.com> a écrit dans le message de
news:aF**************@cpmsftngxa06.phx.gbl...
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:

us**@domain.com

Luke
Microsoft Online Support


Thanks a lot, Luke.

Vince C.
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Marcin Gorzynski | last post: by
1 post views Thread by Joe Fallon | last post: by
7 posts views Thread by Marcus | last post: by
4 posts views Thread by Gridlock | last post: by
reply views Thread by dawson | last post: by
4 posts views Thread by surf_doggie | last post: by
3 posts views Thread by mosesdinakaran | last post: by
3 posts views Thread by Will | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.