Redigera

Dela via


HttpContext.Response Property

Definition

Gets the HttpResponse object for the current HTTP response.

public:
 property System::Web::HttpResponse ^ Response { System::Web::HttpResponse ^ get(); };
public System.Web.HttpResponse Response { get; }
member this.Response : System.Web.HttpResponse
Public ReadOnly Property Response As HttpResponse

Property Value

The HttpResponse for the current HTTP response.

Exceptions

The Web application is running under IIS 7 in Integrated mode.

Remarks

The Response property provides programmatic access to the properties and methods of the HttpResponse class. Because ASP.NET pages contain a default reference to the System.Web namespace (which contains the HttpContext class), you can reference the members of HttpContext on an .aspx page without using the fully qualified class reference to HttpContext. For example, you can use Response.Write("some output") to write output to an HTTP output stream. However, if you want to use the members of HttpResponse from an ASP.NET code-behind module, you must include a reference to the System.Web namespace in the module and a fully qualified reference to the currently active request/response context and the class in System.Web that you want to use. For example, in a code-behind page you must specify the fully qualified name HttpContext.Current.Response.Write("some output").

Applies to