1. mark your web method
[WebMethod(EnableSession=true)]
public int SessionHitCounter() ...
2. on the client side
YourWSProxy ws = YourWSProxy();
ws.CookieContainer = new CookieContainer();
3. if your web service class is not derived from WebService, use
System.Web.HttpContext.Current.Session
[WebMethod(EnableSession=true)]
public int SessionHitCounter() ...
2. on the client side
YourWSProxy ws = YourWSProxy();
ws.CookieContainer = new CookieContainer();
3. if your web service class is not derived from WebService, use
System.Web.HttpContext.Current.Session
本文介绍如何在Web服务中使用标记[WebMethod(EnableSession=true)]启用会话跟踪,包括客户端设置CookieContainer以及非WebService派生类中使用HttpContext.Current.Session的方法。
9577

被折叠的 条评论
为什么被折叠?



