HttpCookie.Name Property
.NET Framework 3.0
Gets or sets the name of a cookie.
Namespace: System.Web
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
/** @property */ public String get_Name () /** @property */ public void set_Name (String value)
public function get Name () : String public function set Name (value : String)
Not applicable.
Property Value
The default value is a null reference (Nothing in Visual Basic) unless the constructor specifies otherwise.The following code example receives a cookie collection from the client in the Cookie header and loops through the collection looking for a cookie with the specific name.
int loop1;
HttpCookie myCookie;
HttpCookieCollection myCookieCollection;
myCookieCollection = get_Request().get_Cookies();
for (loop1 = 0; loop1 < myCookieCollection.get_Count(); loop1++) {
myCookie = myCookieCollection.get_Item(loop1);
if (myCookie.get_Name().equals("UserName")) {
//...
}
}
var myCookie : HttpCookie var myCookieCollection : HttpCookieCollection myCookieCollection = Request.Cookies for(var i = 0; i < myCookieCollection.Count; i++){ myCookie = myCookieCollection[i] if(myCookie.Name == "UserName"){ //... } }
Community Additions
ADD
Show: