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.
Assembly: System.Web (in System.Web.dll)
| Name | Description | |
|---|---|---|
![]() | CookieParameter() | Initializes a new unnamed instance of the CookieParameter class. |
![]() | CookieParameter(CookieParameter) | Initializes a new instance of the CookieParameter class with the values of the instance specified by the original parameter. |
![]() | CookieParameter(String, DbType, String) | Initializes a new instance of the CookieParameter class that has the specified name and database type and that is bound to the specified HTTP cookie. |
![]() | CookieParameter(String, String) | Initializes a new named instance of the CookieParameter class, using the specified string to identify which HTTP cookie to bind to. |
![]() | CookieParameter(String, TypeCode, String) | Initializes a new named and strongly typed instance of the CookieParameter class, using the specified string to identify which HTTP cookie to bind to. |
| Name | Description | |
|---|---|---|
![]() | ConvertEmptyStringToNull | Gets or sets a value indicating whether the value that the Parameter object is bound to should be converted to null if it is String.Empty.(Inherited from Parameter.) |
![]() | CookieName | Gets or sets the name of the HTTP cookie that the parameter binds to. |
![]() | DbType | Gets or sets the database type of the parameter.(Inherited from Parameter.) |
![]() | DefaultValue | |
![]() | Direction | |
![]() | IsTrackingViewState | |
![]() | Name | Gets or sets the name of the parameter.(Inherited from Parameter.) |
![]() | Size | Gets or sets the size of the parameter.(Inherited from Parameter.) |
![]() | Type | Gets or sets the type of the parameter.(Inherited from Parameter.) |
![]() | ValidateInput | Gets or sets a value that specifies whether the parameter's value is validated. |
![]() | ViewState |
| Name | Description | |
|---|---|---|
![]() | Clone() | Returns a duplicate of the current CookieParameter instance.(Overrides Parameter.Clone().) |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Evaluate(HttpContext, Control) | Updates and returns the value of the CookieParameter object.(Overrides Parameter.Evaluate(HttpContext, Control).) |
![]() | Finalize() | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.) |
![]() | GetDatabaseType() | |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | LoadViewState(Object) | Restores the data source view's previously saved view state.(Inherited from Parameter.) |
![]() | MemberwiseClone() | |
![]() | OnParameterChanged() | Calls the OnParametersChanged method of the ParameterCollection collection that contains the Parameter object.(Inherited from Parameter.) |
![]() | SaveViewState() | |
![]() | SetDirty() | |
![]() | ToString() | Converts the value of this instance to its equivalent string representation.(Inherited from Parameter.) |
![]() | TrackViewState() |
| Name | Description | |
|---|---|---|
![]() ![]() | ICloneable.Clone() | |
![]() ![]() | IStateManager.LoadViewState(Object) | This API supports the product infrastructure and is not intended to be used directly from your code. Restores the data source view's previously saved view state.(Inherited from Parameter.) |
![]() ![]() | IStateManager.SaveViewState() | |
![]() ![]() | IStateManager.TrackViewState() | |
![]() ![]() | IStateManager.IsTrackingViewState |
You can use the 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 CookieParameter class provides the CookieName property, which identifies the name of the HttpCookie object to bind to, in addition to those inherited from the Parameter class. The CookieParameter class attempts to bind to the named cookie every time the Evaluate method is called.
Important |
|---|
Controls that bind data to the parameter might throw an exception if a 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 DefaultValue property to avoid these situations where appropriate. |
The following code example demonstrates how to use a SqlDataSource control and CookieParameter object bound to an HTTP cookie to display data from the Northwind Traders database in a GridView control.
Available since 2.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.







