HttpContext.Current Property
.NET Framework 3.5
Updated: May 2011
Gets or sets the HttpContext object for the current HTTP request.
Assembly: System.Web (in System.Web.dll)
You can also use the Context property to access the HttpContext object for the current HTTP request.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Working With HttpContext.Current
http://www.odetocode.com/Articles/112.aspx
- 2/3/2009
- Tim Abell
- 9/2/2010
- Thomas Lee
Create your own http context
Here's a way to create your httpcontext when you need it
http://novatecno.blogspot.com/2010/02/how-to-create-sharepoint-http-context.html
Cheers,
-Edge
http://novatecno.blogspot.com/2010/02/how-to-create-sharepoint-http-context.html
Cheers,
-Edge
- 3/2/2010
- SuperEdge
- 9/2/2010
- Thomas Lee
HttpContext.Current can return null
If you use HttpContext.Current outside web request processing it will return null.
Example could be web-parts running inside Visual Studio in design mode or some shared class library which can run in different contexts.
Example could be web-parts running inside Visual Studio in design mode or some shared class library which can run in different contexts.
- 12/2/2009
- Jan Pěnička
Where to use.
HttpContext.Current is typically used in modules to get access to Request and Response properties and methods
When writing code inside a Page class you can simply use the 'Context' property (which will return HttpContext.Current).
- 11/22/2008
- just.a.nerd