上下文
我在控制器中。爲什麼要在HttpContext.Current之前指出System.Web?
我使用的命名空間System.Web
:
using System.Web;
當我打電話HttpContext.Current
,VS提醒我,Current
不HttpContextBase
定義:
HttpContext.Current.Session["currentUser"];
如果我表明System.Web
HttpContext.Current
之前,它的工作原理:
System.Web.HttpContext.Current.Session["currentUser"];
問題
爲什麼要在HttpContext.Current
之前註明System.Web
?
'HttpContext'在另一個空間中定義的? – 2012-07-24 09:05:52
閱讀我的評論。 HttpContext是控制器 – 2012-07-24 09:06:38
@GG的屬性,是的,拉曼已經解釋了在自己的答案中更流行 – 2012-07-24 09:11:24