0
我试图在web服务中保存会话中的值,但它给了我错误:object reference not set to an instance of an object
。如何在.net中保存会话中的值
Session["ProcessStartTime"] = strDate;
我试图在web服务中保存会话中的值,但它给了我错误:object reference not set to an instance of an object
。如何在.net中保存会话中的值
Session["ProcessStartTime"] = strDate;
添加(EnableSession = True)
到的WebMethod
[WebMethod (EnableSession = true)]
strDate
不为空Session["ProcessStartTime"] = strDate;
启用会议这里是一个样本
public class mytest: System.Web.Services.WebService
{
[WebMethod (EnableSession = true)]
public string HelloWorld()
{
//your logic here
if(strDate!=null)
Session["ProcessStartTime"] = strDate;
else
// handle if ur strDate is null
}
}
确保会话状态为您的web服务启用。 – 2013-02-20 10:51:25
您需要将会话支持添加到Web服务。你使用什么Web服务技术? – Lloyd 2013-02-20 10:51:35
你在使用什么样的文件Session对象? – algreat 2013-02-20 10:56:44