Ejemplo n.º 1
0
        protected void View_Init(object sender, EventArgs e)
        {
            // *** Auto Log In Code ***
            string svUserId      = (string)(Session["UserId"]);
            string svDisplayName = (string)(Session["DisplayName"]);

            // If one of the session vars is empty -- Meaning NOT logged in
            if ((string.IsNullOrEmpty(svUserId) == true) || (string.IsNullOrEmpty(svDisplayName) == true))
            {
                // Try to get UserId from Cookie
                string strUserId = GlobalClass.readUserIdFromCookie();
                if (strUserId != null)
                {
                    // If valid User Id try to look up User in DB & populate session vars
                    if (GlobalClass.getUserInfo(strUserId) == true)
                    {
                        svDisplayName = (string)(Session["DisplayName"]);
                        GlobalClass.checkFavorites();
                        GlobalClass.logLogin("Shopping");
                    }
                    else
                    {
                        Response.Redirect("SignIn.aspx");
                    }
                }
                else
                {
                    // If session vars do not have valid values then back to the home page
                    Response.Redirect("SignIn.aspx");
                }
            }

            lblDisplayName1.Text = svDisplayName;
            lblDisplayName2.Text = svDisplayName;
            // *** Auto Log In Code ***

            if (IsPostBack == false)
            {
                LoadSendTo();
            }
            LoadGrid();
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Request.Browser["IsMobileDevice"] == "true")
            //{
            //    Response.Redirect("MobileShopping.aspx");
            //}
            //else
            //{
            //    Response.Redirect("Home.aspx");
            //}

            // *** Auto Log In Code ***
            string svUserId      = (string)(Session["UserId"]);
            string svDisplayName = (string)(Session["DisplayName"]);

            // If one of the session vars is empty -- Meaning NOT logged in
            if ((string.IsNullOrEmpty(svUserId) == true) || (string.IsNullOrEmpty(svDisplayName) == true))
            {
                // Try to get UserId from Cookie
                string strUserId = GlobalClass.readUserIdFromCookie();
                if (strUserId != null)
                {
                    // If valid User Id try to look up User in DB & populate session vars
                    if (GlobalClass.getUserInfo(strUserId) == false)
                    {
                        Response.Redirect("Home.aspx");
                    }
                }
                else
                {
                    // If session vars do not have valid values then back to the home page
                    Response.Redirect("Home.aspx");
                }
            }

            GlobalClass.checkFavorites();
            GlobalClass.logLogin("Default");
            Response.Redirect("Shopping.aspx");
            // *** Auto Log In Code ***
        }