How to Use Cookies
Keywords: cookie WebDatData dumpinputdata
Question:
How do you use webbatch to read and set cookies from the client?Answer:
Setting Cookies
Cookies are set in the header portion of a html page returned to the user.WebOut('Content-type: text/html', 1) ; Note only 1 LF here WebOut('Set-Cookie: useridcode=Fred;',2) ; Note 2 LF's here to stop header WebOutFile('c:\home\some.html')The above code will set a cookie "useridcode" to value "Fred"Reading Cookies
Do a:http://your.computer.com/webcgi/webbatch.exe?dumpinputdataand see how it shows up there. Then a WebDatData ought to be able to pick it up.Using the example above
useridcode=WebDatData("useridcode")Should return the value "Fred"In addition to the suggestion of looking at the dumpinputdata command, you might want to take a look at the home of weber files; there are a few (somewhat crude, but workable) verbs that handle cookies, including {setcookie} and {ifcookie}. Click on the name of the verb for its source code and you'll see how I did it.
The WebBatch website is created using weber files and has some examples of how they work (see the "how was this done" button).
Article ID: W12477Filename: How to use Cookies.txt