This documentation is archived and is not being maintained.

Page.Response Property

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

[Visual Basic]
Public ReadOnly Property Response As HttpResponse
public HttpResponse Response {get;}
public: __property HttpResponse* get_Response();
public function get Response() : HttpResponse;

Property Value

The current Response object associated with the page.


Exception Type Condition
HttpException The Response object is not available.


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

[Visual Basic] 
Dim MyCookie As New HttpCookie("LastVisit")
Dim now As DateTime = DateTime.Now

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


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

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


HttpCookie* MyCookie = new HttpCookie(S"LastVisit");
DateTime now = DateTime::Now;

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


var myCookie : HttpCookie = new HttpCookie("LastVisit")
var now : DateTime = DateTime.Now

myCookie.Value = now.ToString()
myCookie.Expires = now.AddHours(1)



Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace | HttpResponse