예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["sessionID"] == null)
     {
         MultiView_HeaderTitle.SetActiveView(View_HeaderTitle_Default);
         MultiView_NavTop.SetActiveView(View_NavTop_Default);
         MultiView_Main.SetActiveView(View_Main_Default);
         Literal_Title.Text = PageKits.SiteName;
     }
     else
     {
         MultiView_HeaderTitle.SetActiveView(View_HeaderTitle_User);
         MultiView_NavTop.SetActiveView(View_NavTop_User);
         MultiView_Main.SetActiveView(View_Main_User);
         UsersData users = new UsersData(MapPath("."));
         SessionsData sessions = new SessionsData(MapPath("."));
         string userID = (string)Session["userID"];
         if (!sessions.IsValidSession((string)Session["sessionID"], userID))
         {
             Response.Redirect("signout.aspx?signout=true");
             return;
         }
         string userName = users.FindUserID(userID)["userName"];
         Literal_Title.Text = userName + " - " + PageKits.SiteName;
         Literal_NavTop.Text = PageKits.generateNavTopContent(userID, userName);
         ShowActivities();
     }
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SessionsData sessions = new SessionsData(MapPath("."));
     string userID = (string)Session["userID"];
     if (!sessions.IsValidSession((string)Session["sessionID"], userID))
     {
         Response.Redirect("signout.aspx?signout=true");
         return;
     }
     ShowPage();
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SessionsData sessions = new SessionsData(MapPath("."));
     string userID = (string)Session["userID"];
     if (!sessions.IsValidSession((string)Session["sessionID"], userID))
     {
         Response.Redirect("signout.aspx?signout=true");
         return;
     }
     Literal_NavTop.Text = PageKits.generateNavTopContent(userID, new UsersData(MapPath(".")).FindUserID(userID)["userName"]);
     ShowSentence();
 }
예제 #4
0
 protected void SignDown()
 {
     if (HiddenField_Token.Value != (string)Session["sessinID"])
     {
         throw new InvalidOperationException("Cross-Site Request Forgery (CSRF)");
     }
     SessionsData sessions = new SessionsData(MapPath("."));
     UsersData users = new UsersData(MapPath("."));
     if (!sessions.IsValidSession((string)Session["sessionID"], (string)Session["userID"]))
     {
         throw new InvalidOperationException("The session is invalid.");
     }
     sessions.RemoveSession((string)Session["sessionID"]);
     users.RemoveUser((string)Session["userID"]);
     Session.Abandon();
 }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SessionsData sessions = new SessionsData(MapPath("."));
     string userID = (string)Session["userID"];
     if (!sessions.IsValidSession((string)Session["sessionID"], userID))
     {
         Response.Redirect("signout.aspx?signout=true");
         return;
     }
     if (Request.QueryString["id"] == null)
     {
         Response.Redirect("index.aspx");
     }
     string targetUserID = (string)Request.QueryString["id"];
     UsersData users = new UsersData(MapPath("."));
     string targetUserName = users.FindUserID(targetUserID)["userName"];
     Literal_NavTop.Text = PageKits.generateNavTopContent(userID, users.FindUserID(userID)["userName"]);
     Literal_Title.Text = targetUserName;
     Literal_HeaderTitle.Text = targetUserName;
     ShowFollowingStatus();
     ShowFollows();
     ShowActivities(targetUserID);
 }