都是在本地测试的
webservice
项目1 本地自己项目调试完全正常
- C# code
[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; }
项目2
按照网上找的资料说要利用CookieContainer属性,可调用的时候 session值还是为null 何解啊
- C# code
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(); }
大神门,求解啊
------解决方案--------------------------------------------------------