UserControl.Request 属性

定义

为当前 Web 请求获取 HttpRequest 对象。

public:
 property System::Web::HttpRequest ^ Request { System::Web::HttpRequest ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Web.HttpRequest Request { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Request : System.Web.HttpRequest
Public ReadOnly Property Request As HttpRequest

属性值

HttpRequest

与包含 HttpRequest 实例的 Page 关联的 UserControl 对象。

属性

示例

以下示例使用 Request 属性获取用户控件的物理路径。 With an ID property set to myControl, the user control's location is obtained by a containing page or user control using the myControl.Request.Path syntax.


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


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)

适用于

另请参阅