在asp.net的web服务后台代码
/// <summary> /// 设置Session /// </summary> /// <param name="name"></param> /// <returns></returns> [WebMethod(EnableSession = true)] public static bool setSession(string name) { HttpContext.Current.Session["name"] = System.Web.HttpUtility.UrlDecode(name); return true; } /// <summary> /// 获取session /// </summary> /// <returns></returns> [WebMethod(EnableSession = true)] public static string getSession() { return HttpContext.Current.Session["name"].ToString(); }