Webservice Session问题
[WebMethod(Description = "Hello Demo", EnableSession = true)] public string HelloWorld() { if (System.Web.HttpContext.Current.Session.Count == 0) { return "Hello,World"; } else { return "Hello World, " + System.Web.HttpContext.Current.Session["UserName"].ToString(); } }[WebMethod(Description = "登录", EnableSession = true)] public string ClientLogin(string uName, string pwd) { //判断帐号是否正确 。。。 //创建一个session System.Web.HttpContext.Current.Session["UserName"] = uName; MySQLHelp.SetSession("Login", 0); // return "Hello, " + System.Web.HttpContext.Current.Session["UserName"].ToString(); return "OK:" + ds.Tables[0].Rows[0]["Cname"].ToString(); } else { return "error: 密码不正确,注意区分大小写!"; } }