Where does my local cookie hide and what's it called ?

M

mark4asp

Hello,

I'm running my script locally and the cookie has been saved on the
machine because the login page is by-passed (with the Redirect to
"menu.asp" below.

OK - but where is my cookie stored? Or at least give me clue. What
will the cookie be called and what text will it contain if:
iAuthorID = 1
iSecurityLvl = 3
uName = "barny" ?

The machine user is "flintstone" and machine name is "W2KPro". The
CookieName will be "mABmyASPBlog"

== == == == ==

Const SITE_NAME = "my ASP Blog"

If getCookie("mAB" & replaceText(SITE_NAME, "\W+", "")) Then
Response.Redirect"menu.asp"
End If

Sub saveCookie(uName, CookieName)
Response.Cookies(CookieName)("aid") = Session("iAuthorID")
Response.Cookies(CookieName)("slvl") = Session("iSecurityLvl")
Response.Cookies(CookieName)("login") = uName
Response.Cookies(CookieName).Expires = DateAdd("m",3,Now)
End Sub

Function getCookie(CookieName)
Dim iAuthorID, iSecurityLvl, userName, sSQL, rsAuthor
iAuthorID = Request.Cookies(CookieName)("aid")
iSecurityLvl = Request.Cookies(CookieName)("slvl")
userName = Request.Cookies(CookieName)("login")

If IsWholeNumber(iAuthorID) And IsWholeNumber(iSecurityLvl)
And userName > "" Then
sSQL = "SELECT author_ID FROM tblAuthors" &_
" WHERE userName =" & fixSQLQuotes(userName) &_
" AND author_ID =" & iAuthorID &_
" AND security_ID =" & iSecurityLvl
Set rsAuthor = doAdoRs("Blog", sSql, 0, 1)
If Not (rsAuthor Is Nothing) Then
If Not(rsAuthor.EOF Or rsAuthor.BOF) Then
Session("iAuthorID") = iAuthorID
Session("iSecurityLvl") = iSecurityLvl
saveCookie userName, CookieName
getCookie = True
Exit Function
End If
End If
End If
getCookie = False
End Function
 
T

Tom B

You should find it in your profile, under cookies. Usually, they are named
(e-mail address removed)

The above is assuming IE, I'm sure other browsers store them differently.
 
R

Ray at

The cookie is stored in the location defined at
HKCU\Software\Microsoft\Windows\Currentversion\Explorer\ShellFolders\Cookies
in the registry. In NTx, this would be %userprofile%\cookies. 9x would be
\Windows\cookies, I'm guessing. The filename is
<yourusername>@nameofdomain[#].txt, probably. You can open the cookie in
Notepad and decipher some of it.

Ray at work
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top