我有webservice,提供给用户。用户必须登录才能使用它。 我的问题是当用户通过Web服务上的WSLogin登录时,我想保存会话以便下次检查。与会话呼叫动态web服务
[WebMethod(EnableSession = true)]
public string WSLogin(string username, string password)
{
// do something
string sID = Guid.NewGuid().ToString();
Session.Add("SID", sID); // save session
return sID; // return to user to check next time
}
[WebMethod(EnableSession = true)]
public string CallSomethingService(string sID)
{
string curSID = Session["SID"].ToString() // error, Object reference not set to an instance of an object.
// do some thing
}
我动态调用webservice。 感谢所有帮助
能否请你用的,而不是会议Context.Session? – PraveenVenu 2012-03-04 06:52:00