Page.Response Property

Definition

Gets the HttpResponse object associated with the Page object. This object allows you to send HTTP response data to a client and contains information about that response.

C#
[System.ComponentModel.Browsable(false)]
public System.Web.HttpResponse Response { get; }

Property Value

The current HttpResponse associated with the page.

Attributes

Exceptions

The HttpResponse object is not available.

Examples

The following code example demonstrates creating a cookie and adding it to the page's HTTP output by using the HttpResponse object.

C#
HttpCookie MyCookie = new HttpCookie("LastVisit");
DateTime now = DateTime.Now;

MyCookie.Value = now.ToString();
MyCookie.Expires = now.AddHours(1);

Response.Cookies.Add(MyCookie);

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also