Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Connection = new ConStringProvider(Server.MapPath("/App_Data/ChatCubeDatabase.mdf"));
        if (!IsPostBack)
        {
            if (Session["LoggedInUserID"] != null)
            {
                using (SqlConnection con = new SqlConnection(Connection.ConnectionString))
                {
                    con.Open();

                    int        userid  = int.Parse(Session["LoggedInUserID"].ToString());
                    SqlCommand command = new SqlCommand("select FirstName,Surname from Users_tbl where User_ID='" + userid + "'", con);
                    command.ExecuteNonQuery();
                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        btnLoggedInUser.Text = reader.GetString(0) + " " + reader.GetString(1);
                    }
                    reader.Close();
                    con.Close();
                }
            }
            else
            {
                Session.Remove("LoggedInUserID");
                Response.Redirect("~/Views/LogIn.aspx");
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     Connection = new ConStringProvider(Server.MapPath("/App_Data/ChatCubeDatabase.mdf"));
     if (Session["LoggedInUserID"] == null)
     {
         Response.Redirect("~/Views/LogIn.aspx");
     }
 }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Connection = new ConStringProvider(Server.MapPath("/App_Data/ChatCubeDatabase.mdf"));
         if (!IsPostBack)
         {
             Session["LoggedInUserID"] = null;
             if (Request.Cookies["Email"] != null && Request.Cookies["Password"] != null)
             {
                 txtEmail.Text         = Request.Cookies["Email"].Value;
                 txtPassword.Text      = Request.Cookies["Password"].Value;
                 cbxRememberMe.Checked = true;
             }
         }
     }
     catch
     {
         Session.RemoveAll();
         Response.Redirect("/Views/LogIn.aspx");
     }
 }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Connection = new ConStringProvider(Server.MapPath("/App_Data/ChatCubeDatabase.mdf"));
         if (!IsPostBack)
         {
             if (Session["LoggedInUserID"] == null)
             {
                 EnableSecurityCredentials(true);
             }
             else
             {
                 PopulateInterface();
             }
         }
     }
     catch
     {
         Response.Redirect("/Views/Registration.aspx");
     }
 }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Connection = new ConStringProvider(Server.MapPath("/App_Data/ChatCubeDatabase.mdf"));
         if (!IsPostBack)
         {
             try
             {
                 PopulateInterface();
             }
             catch
             {
                 Session.RemoveAll();
                 Response.Redirect("~/Views/LogIn.aspx");
             }
         }
     }
     catch
     {
         Response.Redirect("/Views/Profile.aspx");
     }
 }