Control.Context Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the HttpContext object associated with the server control for the current Web request.
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
Property Value
The specified HttpContext object associated with the current request.
- Attributes
Examples
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
Remarks
This property gives you access to the HttpContext object for the current Web request. The object provides properties that access the Application, Session, Request, Response and other objects that contain information about the current HTTP request. It also provides methods that allow you to obtain configuration information and set or clear errors for the request.
Applies to
See also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈