VBScript to check for Cookies locally without going to the URL

Posted on 2012-08-29
Medium Priority
Last Modified: 2013-01-22
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
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.

Question by:Snappa2000
  • 2
LVL 23

Accepted Solution

Roopesh Reddy earned 2000 total points
ID: 38345069

Author Comment

ID: 38345099
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.
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38345319

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...
LVL 53

Expert Comment

ID: 38804714
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question