コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     getSession();
     if (!IsPostBack)
     {
         //Get from and to pages:
         string currentPage = "", previousPage = "";
         if (HttpContext.Current.Request.Url.AbsoluteUri != null)
         {
             currentPage = HttpContext.Current.Request.Url.AbsoluteUri;
         }
         if (Request.UrlReferrer != null)
         {
             previousPage = Request.UrlReferrer.ToString();
         }
         //Get current time:
         DateTime currentTime = DateTime.Now;
         //Get user's IP:
         string       userIP         = GetIPAddress();
         CheckSession session        = new CheckSession();
         bool         correctSession = session.sessionIsCorrect(username, roleId, token, currentPage, previousPage, currentTime, userIP);
         if (!correctSession)
         {
             clearSession();
         }
         else
         {
             updateToken();
         }
         fillDropLists();
     }
 }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            //get number of wrong attempts from the database:
            g_numOfTries = getNumberOfTries();
            getSession();
            if (!IsPostBack)
            {
                CheckSession session        = new CheckSession();
                bool         correctSession = session.sessionIsCorrect(username, roleId, token);
                if (!correctSession)
                {
                    clearSession();
                }
                else
                {
                    updateToken();
                }
                pageRefreshes = 0;
                getQuestions();
            }
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     getSession();
     if (!IsPostBack)
     {
         CheckSession session        = new CheckSession();
         bool         correctSession = session.sessionIsCorrect(username, roleId, token);
         if (!correctSession)
         {
             clearSession();
         }
         else
         {
             updateToken();
         }
     }
 }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Configuration config = new Configuration();

            conn    = config.getConnectionString();
            connect = new SqlConnection(conn);
            //get number of wrong attempts from the database:
            g_numOfTries = getNumberOfTries();
            getSession();
            if (!IsPostBack)
            {
                //Get from and to pages:
                string currentPage = "", previousPage = "";
                if (HttpContext.Current.Request.Url.AbsoluteUri != null)
                {
                    currentPage = HttpContext.Current.Request.Url.AbsoluteUri;
                }
                if (Request.UrlReferrer != null)
                {
                    previousPage = Request.UrlReferrer.ToString();
                }
                //Get current time:
                DateTime currentTime = DateTime.Now;
                //Get user's IP:
                string       userIP         = GetIPAddress();
                CheckSession session        = new CheckSession();
                bool         correctSession = session.sessionIsCorrect(username, roleId, token, currentPage, previousPage, currentTime, userIP);
                if (!correctSession)
                {
                    clearSession();
                }
                else
                {
                    updateToken();
                }
                pageRefreshes = 0;
                getQuestions();
            }
        }