Link to home
Start Free TrialLog in
Avatar of Snappa2000
Snappa2000

asked on

VBScript to check for Cookies locally without going to the URL

To anyone,

I need to verify the existence of a cookie, but prefer not navigating to the site.

On the site in the ASP code we have when queried with https://Intro.url?intro=true:

       if (request.querystring("intro") = "true") then
            'write cookie file
            response.Cookies("IntroVideo") = "true"
            Response.Cookies("IntroVideo").Expires = "01 Jan 2014"
      
This sets the cookie for the user and works fine.. as going back to the page proves that...

Under the local script (.VBS) / wscript, the only way to verify the cookie exists is the below code:

Set msie = Wscript.CreateObject("InternetExplorer.Application")
msie.visible = False
msie.Navigate "https://Intro.url"
Do While msie.Busy
      Sleep 20
Loop
IntroCookie = "NotHere"
IntroCookie= msIe.Document.cookie

In the IntroCookie is the contents of the cookie.

How can I prevent the need to navigate to the https://Intro.url, and just check if the cookie exists locally for the user??

If this cant be done via WScript, can someone let me know via what.

Cheers
ASKER CERTIFIED SOLUTION
Avatar of Roopesh Reddy
Roopesh Reddy
Flag of India 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
Avatar of Snappa2000
Snappa2000

ASKER

This will show you the actual files listed in the cookies folder.. They are only DWERTHD.TXT type files, so I cant tell which one is the cookie for the site in reference.

If I can workout for https://Intro.url the corresponding cookie file is TYHSWRP.txt then its fine.. but this will different for every user and machine.
Hi,

I found that solution as the feasible one, other than the one which you have already implemented!

Moreover, you need site name to get the cookie information according to my knowledge. So i feel the original implementation should be fine in this scenario!

Hope it helps u...
Avatar of Dirk Haest
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.