0
我正在對使用HttpContext獲取和設置會話變量的方法進行異步調用。但是當我正在使用它時,HttpContext顯示爲空。那麼我如何使用HttpContext?如何使用HttpContext進行異步調用
代碼:
public void SessionsFetchAllWatchNowAsync()
{
string aaa = Convert.ToString(HttpContext.Current.Session["UserID"]);
}
protected void Page_Load(object sender, EventArgs e)
{
Session[Utility.UserID] = 0;
Action<StartPage> notifyTask = null;
notifyTask = new Action<StartPage>((o) => new StartPage().SessionsFetchAllWatchNowAsync());
if (notifyTask != null)
notifyTask.BeginInvoke(null, null, null);
}
感謝,
Dalvir