/// <summary> /// 获取当前的用户的iD跟UserName /// </summary> /// <returns></returns> public SmsAccountInfo GetCurrentUser() { if (!string.IsNullOrEmpty(Cookie.GetCookie("userid"))) { SmsAccountInfo user = new SmsAccountInfo(); var httpCookie = Cookie.GetCookie("userid"); if (httpCookie != null) { user.ID = int.Parse(httpCookie); } var cookie = Cookie.GetCookie("account"); if (cookie != null) { user.Account = cookie; } if (Session.GetSession(AppContent.USER_KEY) == null) { AccountHandler handler = new AccountHandler(); user = handler.GetAccount(user.ID); Session.SetSession(AppContent.USER_KEY, user); } else { user = Session.GetSession(AppContent.USER_KEY) as SmsAccountInfo; if (user.ID != int.Parse(httpCookie)) { AccountHandler handler = new AccountHandler(); user = handler.GetAccount(int.Parse(httpCookie)); Session.SetSession(AppContent.USER_KEY, user); } } return(user); } return(null); }
protected void Page_Load(object sender, EventArgs e) { AccountHandler handler = new AccountHandler(); SmsAccountInfo info = handler.GetAccount(int.Parse(Request.QueryString["id"])); if (info != null) { account = info.Account; sign = info.Signature; } Page.DataBind(); }