Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

VB - reproduce browser cookie list

Question posted by: pod (Member) on May 6th, 2008 02:10 PM
Is there a way to list all the cookies that are attached to a browser?

I am trying to reproduce the browser cookie list and have search the internet for that script, I have tried some but to no avail...


I would really appreciate if someone could enlighten me on this

I ran the following code but it only shows me the cookie that it belongs to (localhost), and I know there are a lot more cookies that the localhost one:

Code: ( text )
  1. For Each Key in Request.Cookies()
  2.  
  3.       tempvalue=trim(request.Cookies(Key))
  4.          response.write "request.Cookies(" & quote
  5.          response.write Key & quote & ") "
  6.          response.write " =<br><B>" & tempvalue & "</b><p>" & vbcrlf
  7. Next


Thanks,

P:oD
Last edited by pod : May 6th, 2008 at 02:13 PM. Reason: make it clearer
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
jeffstl's Avatar
jeffstl
Expert
385 Posts
May 6th, 2008
02:30 PM
#2

Re: VB - reproduce browser cookie list
I could be wrong about the following, so someone please correct me if I am.

I believe in run time when you are executing a request.cookies you are only accessing the cookies tied to that particular session of the user (Cookies your app created with response.cookie) Not ALL the cookies on that users machine.

If you need to be able to view all the cookies on that users machine you would need to probably use the File System Object and read the cookie files individually from C:\Documents and Settings\username\Cookies

Though I am not sure that will be accessible for all users depending on browser and PC.

If you are using Windows XP\IE you can browse to C:\Documents and Settings\username\Cookies to view the cookie files on your PC.

Reply
DrBunchman's Avatar
DrBunchman
Moderator
763 Posts
May 6th, 2008
02:38 PM
#3

Re: VB - reproduce browser cookie list
As far as I know cookies are restricted by the domain that created them so you cannot access all the cookies on a client machine because most of them were created by other domains.

Out of interest, why would you want to do this?

Dr B

Reply
DrBunchman's Avatar
DrBunchman
Moderator
763 Posts
May 6th, 2008
02:45 PM
#4

Re: VB - reproduce browser cookie list
Quote:
Originally Posted by jeffstl
If you need to be able to view all the cookies on that users machine you would need to probably use the File System Object and read the cookie files individually from C:\Documents and Settings\username\Cookies


Just a quick note after seeing Jeff's comments to say that you can only read the cookies folder of machines which are accessible from your server.

You cannot access a machine's file system through the client for obvious security reasons.

Dr B

Reply
pod's Avatar
pod
Member
67 Posts
May 6th, 2008
03:16 PM
#5

Re: VB - reproduce browser cookie list
Thank you for your replies

To answer your query Doc, I am developing a web application (mywebApp) that among other things opens up a browser to a website (aHelpSite) where I want to retrieve a specific record, (using and ID number in the URL query string). But the site requires a login and I have no control on the site.

So I wanted to detect if the user was already logged in (aHelpSite), i.e. see if there is a aHelpSite cookie.

I think I will keep it simple and warn the user to login into aHelpSite before using the link.

Reply
Reply
Not the answer you were looking for? Post your question . . .
182,270 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top ASP Forum Contributors