Control.Context Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan objek yang HttpContext terkait dengan kontrol server untuk permintaan Web saat ini.
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
Nilai Properti
Objek yang ditentukan HttpContext yang terkait dengan permintaan saat ini.
- Atribut
Contoh
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
Keterangan
Properti ini memberi Anda akses ke HttpContext objek untuk permintaan Web saat ini. Objek menyediakan properti yang mengakses Application, Session, Request, Response dan objek lain yang berisi informasi tentang permintaan HTTP saat ini. Ini juga menyediakan metode yang memungkinkan Anda mendapatkan informasi konfigurasi dan mengatur atau menghapus kesalahan untuk permintaan tersebut.