HttpCookie Constructors
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.
Initializes a new instance of the HttpCookie class.
Overloads
HttpCookie(String) |
Creates and names a new cookie. |
HttpCookie(String, String) |
Creates, names, and assigns a value to a new cookie. |
HttpCookie(String)
Creates and names a new cookie.
public:
HttpCookie(System::String ^ name);
public HttpCookie (string name);
new System.Web.HttpCookie : string -> System.Web.HttpCookie
Public Sub New (name As String)
Parameters
- name
- String
The name of the new cookie.
Examples
The following code example creates and names a new cookie.
HttpCookie MyCookie = new HttpCookie("LastVisit");
Dim MyCookie As New HttpCookie("LastVisit")
Applies to
HttpCookie(String, String)
Creates, names, and assigns a value to a new cookie.
public:
HttpCookie(System::String ^ name, System::String ^ value);
public HttpCookie (string name, string value);
new System.Web.HttpCookie : string * string -> System.Web.HttpCookie
Public Sub New (name As String, value As String)
Parameters
- name
- String
The name of the new cookie.
- value
- String
The value of the new cookie.
Examples
The following code example creates, names, and sets the value of a new cookie.
HttpCookie MyCookie = new HttpCookie("LastVisit",
DateTime.Now.ToString());
Dim MyCookie As New HttpCookie("LastVisit", CStr(DateTime.Now()))
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort: Gedurende 2024 worden GitHub Issues uitgefaseerd als het feedbackmechanisme voor inhoud. Dit wordt vervangen door een nieuw feedbacksysteem. Ga voor meer informatie naar:Feedback verzenden en bekijken voor