我只是发现问题与webmethod无关。
这是由另一个问题引起的。
我设置了Session["PhotoId"]
在正常的 aspx 中。
但我无法检索其中的值webMethod
aspx 页面的。
[WebMethod(EnableSession=true)]
public static string Submit(string data1, ...)
{
string test = HttpContext.Current.Session["PhotoId"]; // test is null
}
我应该怎么办?
据我所知,这里一切都应该很好。
只要 HttpContext.Current.Session 不为 null,这里就支持会话状态。
请确保您设置了 Session["PhotoId"]。
您可以通过检查来测试是否是同一会话
HttpContext.Current.Session.SessionID
在普通的 ASPX 和 WebMethod 中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)