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
| public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsCallback || !Page.IsPostBack)
{
}
}
protected void Login_Click(object sender, EventArgs e)
{
AppConfig conf = AppConfig.createFromDefaultFile();
String user = Request.Params["txtUser"];
String pwd = Request.Params["txtPwd"];
if (conf.checkUserPassword(user, pwd))
{
string sessionId = Session.SessionID;
string token = conf.saveToken(user, sessionId);
string profil = conf.getUserProfil(user);
Session["USER"] = user;
Session["TOKEN"] = token;
Session["PROFIL"] = profil;
}
else
{
Session["USER"] = "";
Session["TOKEN"] = "";
Session["PROFIL"] = "";
Response.Redirect("page1?msg=bad_login");
}
}
protected void Logout_Click(object sender, EventArgs e)
{
BNDGTools.AppConfig.deleteToken((string)Session["TOKEN"]);
Session["USER"] = "";
Session["TOKEN"] = "";
Session["PROFIL"] = "";
Response.Redirect("page1.aspx");
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void Login_Click(object sender, ImageClickEventArgs e)
{
}
} |
Partager