我希望使用webservice在会话中保留完整的html,但是 设置会话步骤抛出此异常。
对象引用未设置为对象的实例。
我的功能是
[WebMethod(Description = "Gsetsession")]
[ScriptMethod(UseHttpGet = false)]
public void SetSession(string html)
{
HttpContext.Current.Session["html"] = html;
}
[WebMethod(Description = "GetSession")]
[ScriptMethod(UseHttpGet = false)]
public string GetSession()
{
if (HttpContext.Current.Session["html"] != null)
{
return HttpContext.Current.Session["html"].ToString();
}
else
{
return "";
}
}
答案 0 :(得分:0)