日期:2014-05-17 浏览次数:20416 次
[WebMethod(Description = "验证是否登录",EnableSession = true)] public string [] CheckIsLogin() { return GetUserLoginName((UserTable)Session["UserLogin"]); } public string[] GetUserLoginName(UserTable user) { string[] s = new string[2]; if (user != null) { if (!string.IsNullOrEmpty(user.UserName)) s[0] = user.UserName; if (!string.IsNullOrEmpty(user.Password)) s[1] = user.Password; } else { s[0] = "test"; s[1] = "test"; } return s; }
private static System.Net.CookieContainer cookieContainer= new System.Net.CookieContainer(); protected void Page_Load(object sender, EventArgs e) { localhost.Cxxf_WebService test = new Test.localhost.Cxxf_WebService(); test.CookieContainer = cookieContainer; string[] s = test.CheckIsLogin(); }