Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2) Response.Redirect("~/Maintenance.html");

            //reading cookies for loginint UserId = 0;
            if (Session["UserId"] != null)
            {
                Response.Redirect("~/Done/Welcome");
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    int UserId = ls.getUserId(VC);
                    if (UserId != 0) //user logged before
                    {
                        Response.Redirect("~/Done/Welcome");
                    }
                }
            }

            if (!Convert.ToBoolean(Application["RegisterAllowed"]))
            {
                LabelError.Text = "Login is not allowed! Please try again later!";
                ButtonRegister.Enabled = false;
            }

            //check if visitor has been invited
            int inviteId = 0;
            try
            {
                inviteId = Convert.ToInt32(Page.RouteData.Values["InviteId"].ToString());

                // create the cookies
                HttpCookie _inviteIdCookies = new HttpCookie("inviteid");
                _inviteIdCookies["inviteid"] = Page.RouteData.Values["InviteId"].ToString();
                _inviteIdCookies.Expires = DateTime.Now.AddHours(1);
                Response.Cookies.Add(_inviteIdCookies);
            }
            catch (Exception ex)
            {

            }
            finally
            {

            }

            if(inviteId != 0)
            {
                HiddenFieldInvite.Value = inviteId.ToString();
                Classes.UserInfo ui = new Classes.UserInfo();
                Tuple<int, string, string> result = ui.getFirstNamePhotoUrlByUserId(inviteId);
                HiddenFieldInviteStatus.Value = result.Item1.ToString(); 
                HiddenFieldInviteName.Value = result.Item2;
                HiddenFieldInvitePhotoUrl.Value = result.Item3;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Application["Status"]) == 2)
            {
                Response.Redirect("~/Maintenance.html");
            }

            //reading cookies for loginint UserId = 0;
            if (Session["UserId"] != null)
            {
                Response.Redirect("~/Done/Welcome");
            }
            else
            {
                if (Request.Cookies["VC"] != null)
                {
                    string VC = Request.Cookies["VC"].Values["VC"];
                    Classes.LoginSession ls = new Classes.LoginSession();
                    int UserId = ls.getUserId(VC);
                    if (UserId != 0) //user logged before
                    {
                        Response.Redirect("~/Done/Welcome");
                    }
                }
            }

            if (!Convert.ToBoolean(Application["RegisterAllowed"]))
            {
                LabelError.Text        = "Login is not allowed! Please try again later!";
                ButtonRegister.Enabled = false;
            }

            //check if visitor has been invited
            int inviteId = 0;

            try
            {
                inviteId = Convert.ToInt32(Page.RouteData.Values["InviteId"].ToString());

                // create the cookies
                HttpCookie _inviteIdCookies = new HttpCookie("inviteid");
                _inviteIdCookies["inviteid"] = Page.RouteData.Values["InviteId"].ToString();
                _inviteIdCookies.Expires     = DateTime.Now.AddHours(1);
                Response.Cookies.Add(_inviteIdCookies);
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }

            if (inviteId != 0)
            {
                HiddenFieldInvite.Value = inviteId.ToString();
                Classes.UserInfo            ui     = new Classes.UserInfo();
                Tuple <int, string, string> result = ui.getFirstNamePhotoUrlByUserId(inviteId);
                HiddenFieldInviteStatus.Value   = result.Item1.ToString();
                HiddenFieldInviteName.Value     = result.Item2;
                HiddenFieldInvitePhotoUrl.Value = result.Item3;
            }
        }