.NET WebService中使用 Session

现象

今天遇到个BUG,获取不到opendid

原因

在WebService中使用Session获取变量,没有设置 EnableSession

WebMethod 默认 EnableSession = false

解决

[WebMethod(EnableSession = true)]

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
public string Binding()
{
  return Session["sessionKey"].ToString();
}
posted @ 2018-12-04 16:44  YanjieZ  阅读(429)  评论(0编辑  收藏  举报
Yanjie Z 的一些学习、踩坑、研究的记录,若有问题欢迎指正