protected override void OnInit(EventArgs e) { base.OnInit(e); returnUrl = Server.UrlEncode(Request.RawUrl); HttpCookie memInfoUser = Request.Cookies["name"]; HttpCookie memInfoPass = Request.Cookies["pass"]; if (AuthenticateUtility.IsAuthenticated()) { if (CurrentUser == null) { CurrentUser = UserController.GetUser(AuthenticateUtility.GetUsername()); } if (CurrentUser == null) { Response.Redirect("/Login.aspx?returnurl=" + returnUrl); } } else { if (memInfoPass != null && memInfoUser.Expires != null) { UserInfo next = UserController.ValidateUser(memInfoUser.Value, memInfoPass.Value); if (AuthenticateUtility.LoginUser(memInfoUser.Value, true)) { if (next != null) { CurrentUser = UserController.GetUser(memInfoUser.Value); } else { Response.Redirect("/Login.aspx?returnurl=" + returnUrl); } } } else { Response.Redirect("/Login.aspx?returnurl=" + returnUrl); } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); returnUrl = Server.UrlEncode(Request.RawUrl); HttpCookie memInfoUser = Request.Cookies["nametemp"]; HttpCookie memInfoPass = Request.Cookies["passtemp"]; if (AuthenticateUtility.IsAuthenticatedTemp()) { CurrentUserTemp = UserController.GetUser(AuthenticateUtility.GetUsernameTemp()); if (CurrentUserTemp == null) { Response.Redirect("/Login.aspx?returnurl=" + returnUrl); } } else { if (memInfoPass != null && memInfoUser != null) { UserInfo info = UserController.ValidateUser(memInfoUser.Value, memInfoPass.Value); //set cookies if (AuthenticateUtility.LoginUserTemp(memInfoUser.Value, true, info)) { if (info != null) { CurrentUserTemp = info; } else { Response.Redirect("/Login.aspx?returnurl=" + returnUrl); } } } else { Response.Redirect("/Login.aspx?returnurl=" + returnUrl); } } }