Export (0) Print
Expand All

Control.Context Property

Gets the HttpContext object associated with the server control for the current Web request.

[Visual Basic]
Protected Overridable ReadOnly Property Context As HttpContext
[C#]
protected virtual HttpContext Context {get;}
[C++]
protected: __property virtual HttpContext* get_Context();
[JScript]
protected function get Context() : HttpContext;

Property Value

The specified HttpContext object assciated with the current request.

Remarks

This property gives you access to the Context 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.

Example

[Visual Basic] 
' Use the Context property to write text to the Response object
' associated with the current request.         
Context.Response.Write("<br><br>ParentControl's OnBubbleEvent called.")
 Context.Response.Write(("<br>Source of event is: " + sender.ToString()))

[C#] 
// Use the Context property to write text to the Response object
// associated with the current request.
Context.Response.Write("<br><br>ParentControl's OnBubbleEvent called.");
Context.Response.Write("<br>Source of event is: " + sender.ToString());

[C++] 
// Use the Context property to write text to the Response object
// associated with the current request.
Context->Response->Write(S"<br><br>ParentControl's OnBubbleEvent called.");
Context->Response->Write(String::Concat(S"<br>Source of event is: ", sender));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Web.UI Namespace | HttpContext | HttpApplication | HttpServerUtility | HttpRequest | HttpResponse

Show:
© 2014 Microsoft