我不知道,爲什麼我們要使用HttpContext.Current?
在這個屬性我用它的會話,但我不知道爲什麼!爲什麼我們要使用HttpContext.Current?
public static string Name
{
get
{
if (HttpContext.Current.Session["_n_"] != null)
return HttpContext.Current.Session["_n_"].ToString();
else return "";
}
set
{
HttpContext.Current.Session["_n_"] = value;
}
}
請參閱http://stackoverflow.com/a/5060948/224370 –
我們使用HttpContext.Current訪問會話對象我n類 –
謝謝這對我很有用:) –