Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         HttpCookie CookieSession = Request.Cookies.Get("UserSession");
         Session["UID"] = CookieSession.Value.ToString();
         ProfileFormView.ChangeMode(FormViewMode.Edit);
         if (Database.IsSessionValid(CookieSession))
         {
             String type = Database.GetUserType(CookieSession.Value.ToString());
             if (type == null)
             {
                 Response.Redirect("../Default.aspx");
             }
             else if (type.ToLower() == "admin")
             {
                 Response.Redirect("./Admin.aspx");
             }
             user     = Database.getUserByID(CookieSession.Value.ToString());
             GameList = new List <Game>();
             foreach (int GID in Database.getGameIDs())
             {
                 GameList.Add(new Game(GID));
             }
         }
         else
         {
             Response.Redirect("../Default.aspx");
         }
     }
     catch
     {
         Response.Redirect("../Default.aspx");
     }
 }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Session["UID"] = Request.Cookies.Get("UserSession").Value.ToString();
         ProfileFormView.ChangeMode(FormViewMode.Edit);
         if (Database.IsSessionValid(Request.Cookies.Get("UserSession")))
         {
             String type = Database.GetUserType(Session["UID"].ToString());
             if (type == null)
             {
                 Response.Redirect("../Default.aspx");
             }
             else if (type.ToLower() == "user")
             {
                 Response.Redirect("./User.aspx");
             }
             else if (type.ToLower() != "admin")
             {
                 Response.Redirect("../Default.aspx");
             }
         }
     } catch
     {
         Response.Redirect("../Default.aspx");
     }
 }