我正在ASP.NET MVC项目上,正好在void method
中的Controller
上工作,我需要使用HttpContext.Current.Request.Cookies
,但Visual Studio识别出Current
为错误,并且未在Intilisense中显示(Current
)。
这是我的方法:
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"); } }
所以请您帮忙吗?
我正在一个ASP.NET MVC项目上,正好在Controller中的void方法上工作,我需要使用HttpContext.Current.Request.Cookies,但是Visual Studio将Current识别为错误,因此未显示(.. 。
正如vivek nuna在他的回答中提到的,需要根据情况使用System.Web.HttpContext.Current.Cookies["xxx"]
时,需要使用Current
。