public LOCALUSER GetUser() { string szPsswordGM = "uniFound808"; string szOpenID = GetOpenID(); if (HttpContext.Current.Session["LoginRes"] != null) { ADMINLOGINRES accInfo = (ADMINLOGINRES)HttpContext.Current.Session["LoginRes"]; if (accInfo.AccInfo.szLogonName != null) { szOpenID = accInfo.AccInfo.szLogonName; } } if (string.IsNullOrEmpty(szOpenID)) { LOCALUSER userRes = new LOCALUSER(); return(userRes); } LOCALUSER user = LocalSQL.GetUser(szOpenID); if (user == null) { user = new LOCALUSER(); } else if ((!string.IsNullOrEmpty(user.szLogonName))) { if (HttpContext.Current.Session["LoginUseInfo"] == null) { string szMsg; if (!Logon(user, out szMsg)) { return(null); } } if (HttpContext.Current.Session["LoginRes"] != null) { ADMINLOGINRES accInfo = (ADMINLOGINRES)HttpContext.Current.Session["LoginRes"]; user.szTrueName = accInfo.AccInfo.szTrueName; user.szLogonName = accInfo.AccInfo.szLogonName; } } else if ((szOpenID != null && szOpenID != "")) { user.szOpenID = szOpenID; user.szLogonName = szOpenID; user.szPassword = szPsswordGM; if (HttpContext.Current.Session["LoginUseInfo"] == null) { string szMsg; if (!Logon(user, out szMsg)) { return(null); } } if (HttpContext.Current.Session["LoginUseInfo"] != null) { ADMINLOGINRES accInfo = (ADMINLOGINRES)HttpContext.Current.Session["LoginRes"]; user.szTrueName = accInfo.AccInfo.szTrueName; user.szLogonName = accInfo.AccInfo.szLogonName; } } user.szOpenID = szOpenID; user.szLogonName = szOpenID; user.szPassword = szPsswordGM;//uniFound808 return(user); }
protected void Page_Load(object sender, EventArgs e) { Session.RemoveAll(); string szSN = Request["sn"]; if (szSN != null) { Response.Redirect("../loginmall.aspx?sn=" + szSN); Response.End(); Logger.trace("szsn=" + szSN); GetUserInfoFromUrl(szSN); } string szOp = Request["op"]; if (szOp == "out" && (Request["szLogonName"] == null || Request["szLogonName"] == "")) { return; } string szSignKey = Request["signkey"]; string szuid = Request["uid"]; if ((!string.IsNullOrEmpty(szSignKey)) && (!string.IsNullOrEmpty(szuid))) { Logger.trace("szSignKey=" + szSN + ";szuid=" + szuid); Logger.trace("szuid=" + szuid); GetUserInfoFromUrl(szuid, szSignKey); } string szUrl = Request["url"]; string szCode = Request["code"]; string szOpenID = Request["openid"]; // Response.Write("url=" + szUrl + ";szcode=" + szCode + ";szopenid=" + szOpenID); Session["LoginUseInfo"] = null; /* * cn.edu.tongji.lib.Service tjser = new cn.edu.tongji.lib.Service(); * if (szCode != null && szCode != "") * { * szOpenID = tjser.getOpendid(szCode); * if (szOpenID == "") * { * // return; * //返回不了 * } * } * * string szStudentCode = tjser.getStudentcode(szOpenID); * // Response.Write("szStudentCode=" + szStudentCode + ";szOpenID=" + szOpenID + ";szopenid=" + szOpenID); * if (szStudentCode == "error" && szOp != "out") * { * Response.Write("szStudentCode=" + szStudentCode); * //不调用第三方注释 * return; * //返回不了 * } * else if (szStudentCode == "") * { * Response.Redirect("http://lib.tongji.edu.cn/wxauth/default.aspx?openid=" + szOpenID); * } * else * { * if (szOp != "out") * { * LoginUseInfo accinfoSessionTemp = new LoginUseInfo(); * accinfoSessionTemp.szLogoName = szStudentCode; * accinfoSessionTemp.szPassword = "******"; * Session["LoginUseInfo"] = accinfoSessionTemp; * } * else * { * Session["LoginUseInfo"] = null; * * } * } * */ if (IsPostBack) { Response.Redirect("index.aspx"); return; } Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); Response.Expires = 0; Response.CacheControl = "no-cache"; LOCALUSER curUser = new LOCALUSER(); if (szOp != "out") { Logger.trace("调用GetUser()"); curUser = GetUser(); if (curUser == null || !string.IsNullOrEmpty(curUser.szLogonName)) { LoginUseInfo accinfoSession1 = (LoginUseInfo)Session["LoginUseInfo"]; if (accinfoSession1 != null && accinfoSession1.szLogoName != "") { Logger.trace("因为调用GetUser()跳转,logonname=" + accinfoSession1.szLogoName); } Response.Redirect("Index.aspx"); } } if (Session["LoginUseInfo"] != null) { LoginUseInfo accinfoSession = (LoginUseInfo)Session["LoginUseInfo"]; if (accinfoSession != null && accinfoSession.szLogoName != "") { Logger.trace("Session['LoginUseInfo']不等于空" + accinfoSession.szLogoName.ToString()); curUser.szLogonName = accinfoSession.szLogoName; curUser.szPassword = accinfoSession.szPassword; if (Logon(curUser, out szMsg)) { Logger.trace("Session['LoginUseInfo']login ok" + accinfoSession.szLogoName.ToString()); LocalSQL.SetUser(curUser); Response.Redirect("index.aspx"); } } } string szLoginAllType = System.Configuration.ConfigurationManager.AppSettings["loginAllType"].ToString(); if (szLoginAllType.ToLower() == "url") { Session["clientUrl"] = "MobileClient/login.aspx"; Response.Redirect("../loginall.aspx"); } string sfid = (string)Session["FID"]; if (Request["szLogonName"] != null && Request["szLogonName"].ToString() != "") { curUser.szOpenID = Request["szLogonName"]; curUser.szLogonName = Request["szLogonName"]; if (curUser.szPassword == null || curUser.szPassword == "") { curUser.szPassword = Request["szPassword"]; } if (string.IsNullOrEmpty(curUser.szLogonName)) { szMsg = "登录名不能为空"; } else { if (Logon(curUser, out szMsg)) { LocalSQL.SetUser(curUser); Response.Redirect("index.aspx"); } } } //szFormID = DateTime.Now.Ticks.ToString(); //Session["FID"] = szFormID; }