How to List All Cookies for a Web Application

Description

Listing cookies in a web application can be done using the Context.Request.Cookies object.

Discussion

Cookies store information for a web application in the client's browser. Cookies are added and removed with Context.Response while reading cookies is be done using Context.Request. Listing the cookies in an application can be done by looping over the Context.Request.Cookies object.

Context.Request.Cookies is a System::Web::HttpCookieCollection that contains information about the cookies in your application. The cookies can be iterated over using FOR EACH ... NEXT to create a list of cookies in your application.

For example, the following Xbasic script prints each cookie and its value in an .a5w page:

Example

<%a5
for each cookieName in Context.Request.Cookies.Keys 
    dim cookie as System::Web::HttpCookie = Context.Request.GetCookie(cookieName.Value)
    ? cookie.Name + " = " + cookie.Value + "<br/>"
next
%>

Limitations

Web Applications Only

See Also