public People connectUser(string username, string password) { People connectedUser = null; User user = bl.getUser(username, password); if (user != null) { if (bl.isJournalist(user)) { connectedUser = new People(user); } } return(connectedUser); }
static void Main(string[] args) { blAccess bl = new blAccess(); Console.Out.WriteLine("Please enter your login :"******"Please enter your password :"******"Only journalist are authorized"); } } else { Console.Out.WriteLine("Could not find a user with such credentials..."); } Console.In.ReadLine(); }
protected void Button1_Click(object sender, EventArgs e) { String password = TextBoxPassword.Text; String username = TextBoxUsername.Text; Session["ConnectedUser"] = dbAccess.getUser(username, password); String redirectUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.PathAndQuery, "/"); redirectUrl += "default.aspx"; if (Session["ConnectedUser"] != null) { /* * if (Request.Cookies.Get("Username") == null) * { * Response.AppendCookie(new HttpCookie("Username", ((DAL_Library.User)Session["ConnectedUser"]).UserName)); * }*/ dbAccess.incConnectionCount(DateTime.Today.Date); Response.Redirect(redirectUrl); } }