This documentation is archived and is not being maintained.

UserControl.Response Property

Gets the Response object for the current Web request.

[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 HttpResponse object associated with the Page that contains the UserControl instance.


[Visual Basic, C#] The following example uses the Response property to write the name of the Web server computer on which the user control is running. The myControl.Response.Write syntax instructs the user control to display the information the control obtains with the myControl.Server.Machinename syntax.

[Visual Basic] 
myControl.Response.Write("<br><b>The server code is running on machine</b> : " + myControl.Server.MachineName)

Dim actualServerPath As String = myControl.MapPath(myControl.Request.Path)


     myControl.Response.Write("<br><b>The server code is running on machine</b> : " + myControl.Server.MachineName);

     string actualServerPath = myControl.MapPath(myControl.Request.Path);

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


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

See Also

UserControl Class | UserControl Members | System.Web.UI Namespace | HttpResponse | Response