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
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET