Ema.H Ema.H - 1 month ago 7
C# Question

Can not access to HttpContext.Current

I can't access to HttpContext.Current on my project MVC4 with C#4.5

I ve added my reference to System.Web in my project and add the using instruction on my controller page...

But i can acces currentHandler only...

var context = HttpContext.CurrentHandler; //Current


Is
HttpContext.Current
deprecated on C#4.5 ?

I ve looked this help page : http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx

Answer

Have you included the System.Web assembly in the application?

using System.Web;

If not, try specifying the System.Web namespace, for example:

 System.Web.HttpContext.Current
Comments