protected void btnLogin_Click(object sender, EventArgs e) { try { var login = new Personal() { correo = txtEmail.Text, password = txtPassword.Text, }; var user = PersonalController.login(login); Session["loginId"] = user.idPersonal; Response.Redirect("inventory.aspx"); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + ex.Message + "');", true);; } }