HttpContext.Current not recognized by Visual Studio [ ASP.NET MVC ]

Viewed 715

I'm working on an ASP.NET MVC project, exactly on a void method in a Controller, and I need to use HttpContext.Current.Request.Cookies but Visual Studio recognized Current as an error, and not shown ( Current ) in the Intilisense.

This is my method :

public void User_Access_Validation()
{

            var T_8 = HttpContext.Current.Request.Cookies["T_8"];
            var T_5 = HttpContext.Current.Request.Cookies["T_5"];
            var T_T = HttpContext.Current.Request.Cookies["T_T"];

            HttpContext.Current.Request.Cookie

            if (T_8 == null || T_5 == null || T_T == null)
            {
                response.Redirect("/Login");
            }
}

So please any help ?

1 Answers

As vivek nuna Mentioned in his answer, you need to use System.Web.HttpContext.Current.Cookies["xxx"] when you need to work with Current in your case.

Related