asp.net.ph

Request.Cookies Property

System.Web Namespace   HttpRequest Class


Gets a collection of cookies sent by the client.

[ VB ]
Public ReadOnly Property Cookies As HttpCookieCollection

[ C# ]
public HttpCookieCollection Cookies {get;}

[ C++ ]
public: __property HttpCookieCollection* get_Cookies ( );

[ JScript ]
public function get Cookies ( ) : HttpCookieCollection;

Property Value

An HttpCookieCollection object representing the client's cookie variables.

Remarks

The Request.Cookies collection enables you to retrieve the values of the cookies sent in an HTTP request. This collection contains all the key=value pairs transmitted by the client to the server in the Cookie header.

Example

The following example [ C# ] shows how you can dynamically retrieve ( and display into an HTML table ) the name, value, expiration date, and security parameter of each HTTP cookie sent by the client.

<table class="data" width="90%">
<tr>
  <th>Name</th>
  <th>Value</th>
  <th>Expires</th>
  <th>Secure</th></tr>

<% foreach ( string key in Request.Cookies ) { %>
<tr>
  <td><%= key %></td>
  <td><%= Request.Cookies[ key ] .Value %></td>
  <td><%= Request.Cookies[ key ] .Expires %></td>
  <td><%= Request.Cookies[ key ] .Secure %></td></tr>
<% } %>
</table>

 Show me 

See Also

Response.Cookies   HttpRequest Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph