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