-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefault.aspx.cs
51 lines (39 loc) · 1.47 KB
/
Default.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Data;
namespace ASPNET_Odonto
{
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BtnLogin_Click (object sender, EventArgs e) {
string key = ConfigurationManager.ConnectionStrings["mysqlConn"].ConnectionString;
MySqlConnection con = new MySqlConnection(key);
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_Iniciar_Sesion";
cmd.Parameters.Add("@usuario", MySqlDbType.VarChar,15).Value = floatingInput.Text;
cmd.Parameters.Add("@pass", MySqlDbType.VarChar, 15).Value = floatingPassword.Text;
cmd.Connection.Open();
MySqlDataReader dReader = cmd.ExecuteReader();
if (dReader.Read())
{
//Sesion de usuario
Session["userSess"] = floatingInput.Text;
Response.Redirect("Home.aspx");
}
else {
lblLog.Text = "Usuario o password incorrectos";
}
cmd.Connection.Close();
//string user = floatingInput.Text;
//string pass = floatingPassword.Text;
//Response.Redirect("home.html/");
}
}
}