Page.Response Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

[BrowsableAttribute(false)]
public HttpResponse Response { get; }

Property Value

Type: System.Web.HttpResponse

The current HttpResponse associated with the page.

Exception Condition
HttpException

The HttpResponse object is not available.

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

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

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

Response.Cookies.Add(MyCookie);

.NET Framework
Available since 1.1
Return to top
Show: