Overview

Headers Cookies

Example of Headers Cookies

Source Code

<?pas
uses System.Net;

// Setting a Cookie (will be available on next reload)
WebResponse.SetCookie('LastVisit', FloatToStr(Now)); 

PrintLn('<h3>Cookies</h3>');
var lastVisit := WebRequest.Cookie['LastVisit'];
if lastVisit = '' then
  PrintLn('No "LastVisit" cookie found. Reload the page to see it.')
else
  PrintLn('Last Visit: ' + lastVisit);

PrintLn('<h3>Request Headers</h3>');
PrintLn('<div style="max-height: 200px; overflow-y: auto; background: #eee; padding: 10px;">');
PrintLn('<pre>' + WebRequest.Headers + '</pre>');
PrintLn('</div>');
?>

Result

<h3>Cookies</h3>
No "LastVisit" cookie found. Reload the page to see it.
<h3>Request Headers</h3>
<div style="max-height: 200px; overflow-y: auto; background: #eee; padding: 10px;">
<pre>Cache-Control=no-cache
Connection=Keep-Alive
Pragma=no-cache
Accept=*/*
Host=localhost.dwscript.net
User-Agent=Mozilla/5.0 (Windows; Synopse DWScript)
</pre>
</div>
On this page