Skip to main content

Retrieving a Cookie

To get the value of the cookie, we simply call the GetCookie method with the name we used when the cookie was saved. The value is assigned to a variable, CatID, with the Set command.

This ObjectScript code appears within a <script> tag, which identifies it as a server-side script.

—TopPicks.csp—
TopPicks.csp
<html> <body>
<script language="cache" runat="server">
    Set CatID = %request.GetCookie("CacheCinemaLastCategory")
</script>
<h2><font color="#0000FF">Today's Top Picks</font></h2>
<table border=0>
<csp:query 
        name=FilmList 
        classname="Cinema.Film" 
        queryname='#(Query)#' P1="#(CatID)#">
        
<csp:while condition="FilmList.Next()"> ... </csp:while>
</table>
</body> </html>
FeedbackOpens in a new tab