ADS MB
ADS MB

Reputation: 175

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

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 ?

Upvotes: 2

Views: 1420

Answers (1)

MBARK T3STO
MBARK T3STO

Reputation: 339

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.

Upvotes: 1

Related Questions