Exemple #1
0
 protected void BLogin_Click(object sender, EventArgs e)
 {
     string email = TBEmail.Text,
         password = TBPassword.Text;
     DBHelper db = new DBHelper(AgentUtileries.dbcstring);
     int id = db.Authenticate(email, password);
     if (id > 0)
     {
         AUser user = db.GetUser(id);
         Session["user"] = user;
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         Response.Redirect("~/User/Login.aspx");
     }
 }
Exemple #2
0
        public XElement Authenticate(string email, string password)
        {
            XElement x = new XElement("users");

            DBHelper db = new DBHelper(AgentUtileries.dbcstring);
            int result = db.Authenticate(email, password);
            if (result > 0)
            {
                AUser user = db.GetUser(result);
                XElement xuser = new XElement("user");
                xuser.Add(new XElement("ID", user.ID));
                xuser.Add(new XElement("Email", user.Email));
                xuser.Add(new XElement("Name", user.Name));
                x.Add(xuser);
            }

            return x;
        }