Professional Documents
Culture Documents
Def Cs
Def Cs
public partial class Default : System.Web.UI.Page { public string Login { get { return txtLogin.Value.Trim(); } } public string Senha { get { return txtSenha.Value.Trim(); } } protected void Page_Load(object sender, EventArgs e) { } private bool ValidarFormulario() { bool erro = string.IsNullOrEmpty(this.Senha) s.Login);
string.IsNullOrEmpty(thi
if (erro) spanMensagemLogin.InnerText = "Todos os campos so necessrios."; return !erro; } protected void btEntrar_Click(object sender, EventArgs e) { if (!this.ValidarFormulario()) return; Autenticacao autentico = new Autenticacao(); if (autentico.Login(this.Login, this.Senha)) { autentico.Redirect(); } else { spanMensagemLogin.InnerText = "Usurio e/ou senha invlidos."; } } protected void btRegistar_Click(object sender, EventArgs e) { HttpContext.Current.Response.Redirect("~/Registo.aspx"); } }