Tag Archives: OpenID

.NET WebServiceSession[WebMethod(EnableSession = true)]

Phenomenon: I encountered a bug today, I can’t get the variable openid

Reason:

Openid is obtained through wechat service and saved in session

Then use session in WebService to get the variable, but the enablesession is not set

Webmethod default enablesession = false

Solution: [webmethod ( enablesession = true )]

[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
public string Binding()
{
  return Session["openid"].ToString();
}