protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //reading cookies for login if (Request.Cookies["VC"] != null) { string VC = Request.Cookies["VC"].Values["VC"]; Classes.LoginSession ls = new Classes.LoginSession(); int UserId = ls.getUserId(VC); if (UserId != 0) //user logged before { Response.Redirect("~/Explore"); } } //check if login is allowed in the system Classes.SiteSettings ss = new Classes.SiteSettings(); bool loginAllowed = Convert.ToBoolean(ss.getSettings("LoginAllow")); if (!loginAllowed) // not allowed { LabelError.Text = "Login is not allowed! Please try again later!"; ButtonLogin.Enabled = false; } } }
protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); Classes.SiteSettings ss = new Classes.SiteSettings(); Tuple <bool, bool, bool, int> result = ss.getAllSettings(); bool loginAllowed = result.Item1; bool registerAllowed = result.Item2; bool activitiesAllowed = result.Item3; int status = result.Item4; Application["LoginAllowed"] = loginAllowed.ToString(); Application["RegisterAllowed"] = registerAllowed.ToString(); Application["ActivitiesAllowed"] = activitiesAllowed.ToString(); Application["Status"] = status.ToString(); }
protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); Classes.SiteSettings ss = new Classes.SiteSettings(); Tuple<bool, bool, bool, int> result = ss.getAllSettings(); bool loginAllowed = result.Item1; bool registerAllowed = result.Item2; bool activitiesAllowed = result.Item3; int status = result.Item4; Application["LoginAllowed"] = loginAllowed.ToString(); Application["RegisterAllowed"] = registerAllowed.ToString(); Application["ActivitiesAllowed"] = activitiesAllowed.ToString(); Application["Status"] = status.ToString(); }