protected void ibtnLogin_Click(object sender, ImageClickEventArgs e) { UsersOR user; try { user = new UsersDA().sp_UserLogin(txtUersName.Text, txtPassword.Text); } catch (Exception ex) { Alert(ex.Message.Replace("'", "").Replace("\r\n", "")); return; } Session["CurrentUser"] = user; HttpCookie cookieGuid = new HttpCookie("CurrentUser"); cookieGuid.Expires = DateTime.Now.AddHours(9); cookieGuid.Values.Add("UserID", user.Guid); cookieGuid.Values.Add("LoginName", user.LogonName); cookieGuid.Values.Add("UserName", user.DisplayName); cookieGuid.Values.Add("Password", user.UserPwd); cookieGuid.Path = "/"; Response.AppendCookie(cookieGuid); List<VHC_USER_PERMISSIONS> _Permissions = new UserPermissionsDA().GetListByUserID(user.Guid); if (_Permissions.Count == 0) { Alert("未授权,无法访问该系统。"); return; } Session["UserPermissions"] = _Permissions; Response.Redirect("~/Main/Default.aspx"); }
private void InitUserInfo() { if (Request.QueryString["userid"] != null) { UsersOR obj = new UsersDA().selectARowDateByGuid(Request.QueryString["userid"].ToString()); if (obj != null) { this.txt_UserName.Text = obj.LogonName; //this.txt_phone.Text = obj.PHONE; this.txt_name.Text = obj.DisplayName; } } }