HttpResponse.SetCookie(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.
Because the HttpResponse.SetCookie method is intended for internal use only, you should not call it in your code. Instead, you can call the HttpResponse.Cookies.Set method, as the following example shows.
Updates an existing cookie in the cookie collection.
public:
void SetCookie(System::Web::HttpCookie ^ cookie);
public void SetCookie (System.Web.HttpCookie cookie);
member this.SetCookie : System.Web.HttpCookie -> unit
Public Sub SetCookie (cookie As HttpCookie)
Parameters
- cookie
- HttpCookie
The cookie in the collection to be updated.
Exceptions
Attempted to set the cookie after the HTTP headers were sent.
Examples
The following example updates the value of an existing cookie.
MyCookie.Value = DateTime.Now.ToString();
Response.Cookies.Set(MyCookie);
MyCookie.Value = CStr(DateTime.Now())
Response.Cookies.Set(MyCookie)
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET