views:

101

answers:

2

Hi,

I've got a project which as a reference added to System.Web.

However, it can't seem to pick up HttpContext. Doing this:

Imports System.Web
_ApplicationBase = HttpContext.Current()

Tells me that HttpContext is not declared. If you look at the methods and properties inside System.Web there are hardly any showing: only AspHostingPermission, AspHostingPermissionAttribute, AspHostingPermissionLevel and Services.

The reference is valid and pointing to the right place. This is driving me crazy - what have I missed?

Cheers, Matt

+1  A: 

An HttpContext object exists only during an asp.net request on the thread that is processing the request. In any other thread or process, there is no HttpContext available.

Pent Ploompuu
This is correct if the error happens at run-time. If it happens at design time then you're missing a reference to the System.Web.dll assembly.
Keith
A: 

If this error is happening at design time then it's a case of a missing assembly reference. Make sure your project is referencing the System.Web.dll assembly.

Keith