protected void btnRegistro_Click(object sender, EventArgs e) { string striNombreEmpresa = Request.Form["iNombreComercial"]; string striCorreoElectronicoContacto = Request.Form["iCorreoElectronicoContacto"]; string striNombreAdministrador = Request.Form["iNombreAdministrador"]; string striApellidoPaternoAdministrador = Request.Form["iApellidoPaternoAdministrador"]; string striApellidoMaternoAdministrador = Request.Form["iApellidoMaternoAdministrador"]; if (ControlEmpresa.AltaEmpresaRegistro(striNombreEmpresa)) { iNombreComercial.Value = String.Empty; } if (ControlUsuarios.AltaUsuarioRegistro(striNombreAdministrador, striApellidoPaternoAdministrador, striApellidoMaternoAdministrador, striCorreoElectronicoContacto)) { iNombreAdministrador.Value = String.Empty; iApellidoPaternoAdministrador.Value = String.Empty; iApellidoMaternoAdministrador.Value = String.Empty; iCorreoElectronicoContacto.Value = String.Empty; lblSuccess.Text = "Datos guardados con éxito, revisa el buzón de tu correo, si no aparece el mensaje de Notificaciones POS Automaticas, busca en tu bandeja de SPAM y selecciónalo como correo seguro ya que seguirán llegando correos de esta cuenta"; upModal.Update(); modSuccess.Show(); } else { lblSuccess.Text = "Err."; upModal.Update(); modSuccess.Show(); } }
public ActionResult Login(String usuario, String password) { ControlUsuarios control = new ControlUsuarios(); if (control.ExisteUsuario(usuario, password)) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, usuario, DateTime.Now, DateTime.Now.AddMinutes(15), true, control.Role); String datosCifrados = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie("TicketUsuario", datosCifrados); Response.Cookies.Add(cookie); return(RedirectToAction("Index", "Administracion")); } return(View()); }
public ActionResult Login(String usuario, String password) { //VALIDAR SI EL USUARIO QUE NOS HAN ENVIADO ES CORRECTO //SI ES CORRECTO, CREAMOS UN TICKET (cookie encriptada) ControlUsuarios control = new ControlUsuarios(); if (control.ExisteUsuario(usuario, password)) { //VERSION, FECHA CREACION, FECHA EXPIRACION, NAME(ID USER), DONDE ALMACENAR LA COOKIE, USERDATA(datos que no sirven. Es información extra del usuario) FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, usuario, DateTime.Now, DateTime.Now.AddMinutes(10), true, control.role); //ESTE TICKET SERÁ ALMACENADO EN UNA COOKIE, PARA QUE SEA UN TICKET VÁLIDO TENEMOS QUE ENCRIPTARLA String datoscifrados = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie("TICKETUSUARIO", datoscifrados); //ALMACENAMOS LA COOKIE EN EL EXPLORADOR DEL CLIENTE Response.Cookies.Add(cookie); //ENVIAMOS A LA PAGINA DE ADMINISTRACION INDEX MANUALMENTE return(RedirectToAction("Index", "Administracion")); } return(View()); }