Control.Context プロパティ

定義

現在の Web 要求に対するサーバー コントロールに関連付けられている HttpContext オブジェクトを取得します。

protected:
 virtual property System::Web::HttpContext ^ Context { System::Web::HttpContext ^ get(); };
protected public:
 virtual property System::Web::HttpContext ^ Context { System::Web::HttpContext ^ get(); };
[System.ComponentModel.Browsable(false)]
protected virtual System.Web.HttpContext Context { get; }
[System.ComponentModel.Browsable(false)]
protected internal virtual System.Web.HttpContext Context { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Context : System.Web.HttpContext
Protected Overridable ReadOnly Property Context As HttpContext
Protected Friend Overridable ReadOnly Property Context As HttpContext

プロパティ値

現在の要求に関連付けられている、指定された HttpContext オブジェクト。

属性

protected override bool OnBubbleEvent(object sender, EventArgs e)
{

   // Use the Context property to write text to the TraceContext object
   // associated with the current request.
   Context.Trace.Write("The ParentControl's OnBubbleEvent method is called.");
   Context.Trace.Write("The Source of event is: " + sender.ToString());

   return true;
}
<System.Security.Permissions.PermissionSetAttribute( _
    System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Function OnBubbleEvent(ByVal sender As Object, ByVal e As EventArgs) As Boolean

    ' Use the Context property to write text to the TraceContext object
    ' associated with the current request.         
    Context.Trace.Write("The ParentControl's OnBubbleEvent method is called.")
    Context.Trace.Write("The Source of event is: " + sender.ToString())

    Return True
End Function 'OnBubbleEvent

注釈

このプロパティを使用すると、現在の Web 要求の HttpContext オブジェクトにアクセスできます。 オブジェクトは、、および現在の HTTP 要求にApplicationSessionRequestResponse関する情報を含む他のオブジェクトにアクセスするプロパティを提供します。 また、構成情報を取得し、要求のエラーを設定またはクリアできるメソッドも用意されています。

適用対象

こちらもご覧ください