System.Web.UI.WebControls.CookieParameter Class

Binds the value of a client-side HTTP cookie to a parameter object. The parameter can be used in a parameterized query or command to select, filter, or update data.

See Also: CookieParameter Members


public class CookieParameter : Parameter


You can use the System.Web.UI.WebControls.CookieParameter class to bind the value of a client-side HTTP cookie passed as part of an HTTP request to a parameter used by ASP.NET data source controls.

The System.Web.UI.WebControls.CookieParameter class provides the CookieParameter.CookieName property, which identifies the name of the System.Web.HttpCookie object to bind to, in addition to those inherited from the System.Web.UI.WebControls.Parameter class. The System.Web.UI.WebControls.CookieParameter class attempts to bind to the named cookie every time the CookieParameter.Evaluate(System.Web.HttpContext, System.Web.UI.Control) method is called.


Controls that bind data to the parameter might throw an exception if a System.Web.UI.WebControls.CookieParameter object is specified, but no corresponding cookie is passed with the HTTP request. Similarly, they might display no data if the cookie is passed with null. Set the Parameter.DefaultValue property to avoid these situations where appropriate.


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0