Control.Context Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar objektet HttpContext som är associerat med serverkontrollen för den aktuella webbbegäran.
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
Egenskapsvärde
Det angivna HttpContext objektet som är associerat med den aktuella begäran.
- Attribut
Exempel
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
Kommentarer
Den här egenskapen ger dig åtkomst till HttpContext objektet för den aktuella webbbegäran. Objektet innehåller egenskaper som har åtkomst till Application, Session, RequestResponse och andra objekt som innehåller information om den aktuella HTTP-begäran. Den innehåller också metoder som gör att du kan hämta konfigurationsinformation och ange eller rensa fel för begäran.