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
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour