Export (0) Print
Expand All

Page.Response Property

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)

'Declaration
PublicReadOnlyPropertyResponseAsHttpResponse
'Usage
DiminstanceAsPageDimvalueAsHttpResponsevalue = instance.Response
/** @property */
public HttpResponse get_Response ()

public function get Response () : HttpResponse

Not applicable.

Property Value

The current HttpResponse associated with the page.

Exception typeCondition

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.

Dim MyCookie As New HttpCookie("LastVisit")
Dim now As DateTime = DateTime.Now

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

Response.Cookies.Add(MyCookie)
   

HttpCookie myCookie = new HttpCookie("LastVisit");
DateTime now = DateTime.get_Now();

myCookie.set_Value(now.ToString());
myCookie.set_Expires(now.AddHours(1));

get_Response().get_Cookies().Add(myCookie);

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

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

Response.Cookies.Add(myCookie)
   

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft