Export (0) Print
Expand All
5 out of 18 rated this helpful - Rate this topic

HttpContext.Current Property

Gets or sets the HttpContext object for the current HTTP request.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)
static member Current : HttpContext with get, set

Property Value

Type: System.Web.HttpContext
The HttpContext instance for the current HTTP request.

This property is a static property of the HttpContext class. The property stores the HttpContext instance that applies to the current request. The properties of this instance are the non-static properties of the HttpContext class.

You can also use the Page.Context property to access the HttpContext object for the current HTTP request.

The following code example uses the Current property to access the HttpContext.AddError and HttpContext.ClearError methods and the HttpContext.AllErrors property. The example creates three custom exceptions using the AddError method and uses the AllErrors property to load these exceptions to an array. It then writes the array to the containing page and uses the ClearError method to clear all the errors from the Context property.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.