Link to home
Start Free TrialLog in
Avatar of simongod
simongod

asked on

report on cookie contents to server

i am not sure if this would fall under javascript programming or not, any language is prefered as long as it can be done.  i want to check the contents of a cookie stored on a users pc and then report the contents of that cookie to a website that can display its info.  any ideas on how this might be accomplished
Avatar of Emad Gawai
Emad Gawai
Flag of United Arab Emirates image

u are looking for this :

Sub ShowCookies()
      Dim cookie, key
            For Each cookie In Request.Cookies
                  If Not Request.Cookies(cookie).HasKeys Then
                          Response.Write cookie & " = " & _
                        Request.Cookies(cookie) & "<br>"
                  Else
                        For      Each key In Request.Cookies(cookie)
                              Response.Write cookie
                              Response.Write "(" & key & ")"
                              Response.Write " = "
                              Response.Write Request.Cookies(cookie)(key)
                              Response.Write "<br>" & vbCrLf
                        Next
                  End If
            Next
End Sub
Avatar of simongod
simongod

ASKER

maybe i should expand on that i little more, when someone goes to my website i want to check that cookie on there pc and then report its contents.  i am not very good with vb, i prefer c++ or javascript.  i can understand vb and could rewrite its code into vc++ exquivelant
ASKER CERTIFIED SOLUTION
Avatar of Anubis2005
Anubis2005
Flag of Vanuatu image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can i refer to a cookie's filename?  another website stores a cookie and thats the one that i want to reference.
Cookies are only accessible on the domain that they are created from, you cannot access other sites cookies...

For example, if you create a cookie for the domain xyz.com you would not be able to access it from zyx.com.  This is a security mechanizim built into each browser which supports cookies.   You can however configure a cookie created a beta.xyz.com to be able to be ready by xyz.com by altering the 'domain' setting of the cookie.
what if the domain is the same?  for instance, i use a free web hosting service that others can use too.  write to a cookie and another users "web site"  writes to a cookie can i access that cookies data?  we are both on the same domain, such as geocities.com
Hmm... It should technically be accessible, however you would need to ensure that the 'Domain' portion of the cookie is set to only the 'geocities.com' namespace and the 'Path' is set to '/'.  This should potentially allow the cookie to be read from all sub-sites within GeoCities.

For further info, please see: http://wp.netscape.com/newsref/std/cookie_spec.html