HttpCookieCollection.Set(HttpCookie) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Updates the value of an existing cookie in a cookie collection.
public:
void Set(System::Web::HttpCookie ^ cookie);
public void Set (System.Web.HttpCookie cookie);
member this.Set : System.Web.HttpCookie -> unit
Public Sub Set (cookie As HttpCookie)
Parameters
- cookie
- HttpCookie
The HttpCookie object to update.
Examples
The following example updates the value of an existing cookie.
MyCookie.Value = DateTime.Now.ToString();
MyCookieCollection.Set(MyCookie);
MyCookie.Value = DateTime.Now().ToString()
MyCookieCollection.Set(MyCookie)
Remarks
The Set method first checks to see if a cookie already exists in the collection and if so updates it. The Set method does not allow duplicate cookies in the cookie collection. To add duplicate cookies in the cookie collection, use the Add method.
Applies to
See also
التعاون معنا على GitHub
يمكن العثور على مصدر هذا المحتوى على GitHub حيث يمكنك أيضاً إضافة مشاكل وطلبات سحب ومراجعتها. للحصول على معلومات إضافية، اطلع على دليل المساهم لدينا.