Exemplo n.º 1
0
        private void SagePageLoadPart()
        {
            if (!IsPostBack)
            {
                string          sageNavigateUrl = string.Empty;
                SageFrameConfig sfConfig        = new SageFrameConfig();
                if (!IsParent)
                {
                    sageNavigateUrl = GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + Extension;
                }
                else
                {
                    sageNavigateUrl = GetParentURL + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + Extension;
                }
                hypPreview.NavigateUrl = sageNavigateUrl;
                Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetAdminImageUrl("ajax-loader.gif", true);
                }
            }
            SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];

            if (string.IsNullOrEmpty(sessionTracker.PortalID))
            {
                sessionTracker.PortalID = GetPortalID.ToString();
                sessionTracker.Username = GetUsername;
                SageFrameConfig sfConfig = new SageFrameConfig();
                sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.InsertSessionTrackingPages);
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
                Session[SessionKeys.Tracker] = sessionTracker;
            }
        }
Exemplo n.º 2
0
        private void LogInPublicModeRegistration()
        {
            string strRoles             = string.Empty;
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text.Trim());

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        sessionTracker.PortalID      = GetPortalID.ToString();
                        sessionTracker.Username      = UserName.Text;
                        Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                        {
                            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                             user.UserName,
                                                                                             DateTime.Now,
                                                                                             DateTime.Now.AddMinutes(30),
                                                                                             true,
                                                                                             GetPortalID.ToString(),
                                                                                             FormsAuthentication.FormsCookiePath);

                            // Encrypt the ticket.
                            string encTicket = FormsAuthentication.Encrypt(ticket);

                            // Create the cookie.
                            string randomCookieValue = GenerateRandomCookieValue();
                            Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                            SecurityPolicy  objSecurity            = new SecurityPolicy();
                            HttpCookie      cookie                 = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                            SageFrameConfig objConfig              = new SageFrameConfig();
                            string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                            int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                            expiryTime     = expiryTime < 5 ? 5 : expiryTime;
                            cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                            Response.Cookies.Add(cookie);

                            if (!IsParent)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void LogInPublicModeRegistration()
        {
            string strRoles             = string.Empty;
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text);

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        sessionTracker.PortalID      = GetPortalID.ToString();
                        sessionTracker.Username      = UserName.Text;
                        Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                        {
                            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                             user.UserName,
                                                                                             DateTime.Now,
                                                                                             DateTime.Now.AddMinutes(30),
                                                                                             true,
                                                                                             GetPortalID.ToString(),
                                                                                             FormsAuthentication.FormsCookiePath);

                            // Encrypt the ticket.
                            string encTicket = FormsAuthentication.Encrypt(ticket);

                            // Create the cookie.
                            Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                            bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                            if (IsUseFriendlyUrls)
                            {
                                if (GetPortalID > 1)
                                {
                                    Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                                }
                                else
                                {
                                    Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                                }
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void SagePageLoadPart()
        {
            LoadGlobalVariables();
            if (!IsPostBack)
            {
                hypHome.NavigateUrl    = sageNavigateUrl;
                hypHome.Text           = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
                hypHome.ImageUrl       = GetTemplateImageUrl("home.png", true);
                hypPreview.NavigateUrl = hypHome.NavigateUrl;
                Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                bool IsAdmin = false;
                if (HttpContext.Current.User != null)
                {
                    MembershipUser user = Membership.GetUser();
                    if (user != null)
                    {
                        string[] sysRoles = SystemSetting.SYSTEM_SUPER_ROLES;
                        foreach (string role in sysRoles)
                        {
                            if (Roles.IsUserInRole(user.UserName, role))
                            {
                                IsAdmin = true;
                                break;
                            }
                        }
                    }
                }
                if (IsAdmin)
                {
                    divAdminControlPanel.Attributes.Add("style", "display:block");
                }
                else
                {
                    divAdminControlPanel.Attributes.Add("style", "display:none");
                }
                Session["payMentGateWayRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());
            }
            SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];

            if (string.IsNullOrEmpty(sessionTracker.PortalID))
            {
                sessionTracker.PortalID = GetPortalID.ToString();
                sessionTracker.Username = GetUsername;
                SageFrameConfig sfConfig = new SageFrameConfig();
                sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
                Session["Tracker"] = sessionTracker;
            }
        }
        private void LogInPublicModeRegistration()
        {
            string strRoles             = string.Empty;
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text);

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                        sessionTracker.PortalID = GetPortalID.ToString();
                        sessionTracker.Username = UserName.Text;
                        Session["Tracker"]      = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        string          ReturnUrl     = string.Empty;
                        SageFrameConfig sfConfig      = new SageFrameConfig();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username,
                                                          GetPortalID.ToString());
                        FormsAuthentication.SetAuthCookie(UserName.Text, true);

                        if (Request.QueryString["ReturnUrl"] != null)
                        {
                            Response.Redirect(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()), false);
                        }
                        else
                        {
                            bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                            if (IsUseFriendlyUrls)
                            {
                                if (GetPortalID > 1)
                                {
                                    Response.Redirect("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx", false);
                                }
                                else
                                {
                                    Response.Redirect("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx", false);
                                }
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Sets session tracker values for any thing  requested URL.
 /// </summary>
 /// <param name="portalID">Portal ID.</param>
 /// <param name="userName">User's name.</param>
 public void SetSessionTrackerValues(string portalID, string userName)
 {
     //SessionTracker sessionTracker = (SessionTracker)HttpContext.Current.Session[SessionKeys.Tracker];
     //if (string.IsNullOrEmpty(sessionTracker.PortalID))
     //{
     //sessionTracker.PortalID = portalID;
     //sessionTracker.Username = userName;
     //SageFrameConfig sfConfig = new SageFrameConfig();
     //sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.InsertSessionTrackingPages);
     SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
     SLog.SessionTrackerUpdateUsername(userName, portalID);
     //HttpContext.Current.Session[SessionKeys.Tracker] = sessionTracker;
     // }
 }
 /// <summary>
 /// Sets session tracker values for any thing  requested URL.
 /// </summary>
 /// <param name="portalID">Portal ID.</param>
 /// <param name="userName">User's name.</param>
 public void SetSessionTrackerValues(string portalID, string userName)
 {
     //SessionTracker sessionTracker = (SessionTracker)HttpContext.Current.Session[SessionKeys.Tracker];
     //if (string.IsNullOrEmpty(sessionTracker.PortalID))
     //{
         //sessionTracker.PortalID = portalID;
         //sessionTracker.Username = userName;
         //SageFrameConfig sfConfig = new SageFrameConfig();
         //sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.InsertSessionTrackingPages);
         SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
         SLog.SessionTrackerUpdateUsername(userName, portalID);
         //HttpContext.Current.Session[SessionKeys.Tracker] = sessionTracker;
    // }
 }
 public void SetSessionTrackerValues(string portalID, string userName)
 {
     SessionTracker sessionTracker = (SessionTracker)HttpContext.Current.Session[SessionKeys.Tracker];
     if (string.IsNullOrEmpty(sessionTracker.PortalID))
     {
         sessionTracker.PortalID = portalID;
         sessionTracker.Username = userName;
         SageFrameConfig sfConfig = new SageFrameConfig();
         sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);
         SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
         SLog.SessionTrackerUpdateUsername(sessionTracker, userName, portalID);
         HttpContext.Current.Session[SessionKeys.Tracker] = sessionTracker;
     }
 }
        public void SetSessionTrackerValues(string portalID, string userName)
        {
            SessionTracker sessionTracker = (SessionTracker)HttpContext.Current.Session[SessionKeys.Tracker];

            if (string.IsNullOrEmpty(sessionTracker.PortalID))
            {
                sessionTracker.PortalID = portalID;
                sessionTracker.Username = userName;
                SageFrameConfig sfConfig = new SageFrameConfig();
                sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, userName, portalID);
                HttpContext.Current.Session[SessionKeys.Tracker] = sessionTracker;
            }
        }
        private void LogInPublicModeRegistration(UserInfo user)
        {
            string          strRoles  = string.Empty;
            RoleController  role      = new RoleController();
            SageFrameConfig sfConfig  = new SageFrameConfig();
            string          userRoles = role.GetRoleNames(user.UserName, GetPortalID);

            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                sessionTracker.PortalID      = GetPortalID.ToString();
                sessionTracker.Username      = user.UserName;
                Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     user.UserName,
                                                                                     DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(30),
                                                                                     true,
                                                                                     GetPortalID.ToString(),
                                                                                     FormsAuthentication.FormsCookiePath);
                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);
                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    bool IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                    if (IsUseFriendlyUrls)
                    {
                        if (GetPortalID > 1)
                        {
                            Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
                        }
                        else
                        {
                            Response.Redirect(ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
                        }
                    }
                    else
                    {
                        Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void LogInPublicModeRegistration(UserInfo user)
        {
            string          strRoles  = string.Empty;
            RoleController  role      = new RoleController();
            SageFrameConfig sfConfig  = new SageFrameConfig();
            string          userRoles = role.GetRoleIDs(user.UserName, GetPortalID);

            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                //sessionTracker.PortalID = GetPortalID.ToString();
                //sessionTracker.Username = user.UserName;
                //Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog       = new SageFrame.Web.SessionLog();
                SageFrameConfig          SageConfig = new SageFrameConfig();
                SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
                bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.EnableSessionTracker));
                if (EnableSessionTracker)
                {
                    SLog.SessionTrackerUpdateUsername(user.UserName, GetPortalID.ToString());
                }
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     user.UserName,
                                                                                     DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(30),
                                                                                     true,
                                                                                     GetPortalID.ToString(),
                                                                                     FormsAuthentication.FormsCookiePath);
                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);
                    // Create the cookie.
                    SecurityPolicy objSecurity = new SecurityPolicy();
                    Response.Cookies.Add(new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket));
                    if (!IsParent)
                    {
                        Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
                    }
                    else
                    {
                        Response.Redirect(ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
                    }
                }
            }
        }
Exemplo n.º 12
0
        private void SagePageLoadPart()
        {
            try
            {
                CreateGlobalVariables();
                if (!IsPostBack)
                {
                    hypHome.NavigateUrl    = sageNavigateUrl;
                    hypHome.Text           = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
                    hypHome.ImageUrl       = GetTemplateImageUrl("home.png", true);
                    hypPreview.NavigateUrl = hypHome.NavigateUrl;
                    Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                    if (imgProgress != null)
                    {
                        imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                    }
                }
                if ((SessionTracker)Session["Tracker"] != null)
                {
                    SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                    if (string.IsNullOrEmpty(sessionTracker.PortalID))
                    {
                        sessionTracker.PortalID = GetPortalID.ToString();
                        sessionTracker.Username = GetUsername;
                        SageFrameConfig sfConfig = new SageFrameConfig();
                        sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);

                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
                        SLog.StoreSessionTrackerAdd(sessionTracker, GetStoreID, GetPortalID);
                        Session["Tracker"] = sessionTracker;
                    }
                }
                //if ((StoreSettingInfo)Session["DefaultStoreSettings"] == null)
                //{
                //    AspxCommerceWebService AspxCommerceWebService = new AspxCommerceWebService();
                //    StoreSettingInfo DefaultStoreSettings = AspxCommerceWebService.GetAllStoreSettings(GetStoreID, GetPortalID, GetCurrentCultureName);
                //    Session["DefaultStoreSettings"] = DefaultStoreSettings;
                //}
            }
            catch
            {
            }
        }
Exemplo n.º 13
0
    private void SagePageLoadPart()
    {
        try
        {
            if (!IsPostBack)
            {
                    

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalServicePath", " var aspxservicePath='" + ResolveUrl("~/") + "Modules/ASPXCommerce/ASPXCommerceServices/" + "';", true);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalRootPath", " var aspxRootPath='" + ResolveUrl("~/") + "';", true);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalTemplateFolderPath", " var aspxTemplateFolderPath='" + ResolveUrl("~/") + "Templates/" + TemplateName + "';", true);
            
                SageFrameConfig sfConfig = new SageFrameConfig();
                IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                string sageRedirectPath = string.Empty;
                string sageNavigateUrl = string.Empty;
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        sageRedirectPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/");
                        sageNavigateUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                    }
                    else
                    {
                        sageRedirectPath = ResolveUrl("~/");
                        sageNavigateUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                    }
                }
                else
                {
                    sageRedirectPath = ResolveUrl("{~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                    sageNavigateUrl = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalRedirectPath", " var aspxRedirectPath='" + sageRedirectPath + "';", true);

                hypHome.NavigateUrl = sageNavigateUrl;
                hypHome.Text = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
                hypHome.ImageUrl = GetTemplateImageUrl("home.png", true);
                hypPreview.NavigateUrl = hypHome.NavigateUrl;
                Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                    
            }
            if ((SessionTracker)Session["Tracker"] != null)
            {
                SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                if (string.IsNullOrEmpty(sessionTracker.PortalID))
                {
                    sessionTracker.PortalID = GetPortalID.ToString();
                    sessionTracker.Username = GetUsername;
                    SageFrameConfig sfConfig = new SageFrameConfig();
                    sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);

                    SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                    SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
                    SLog.StoreSessionTrackerAdd(sessionTracker, GetStoreID, GetPortalID);
                    Session["Tracker"] = sessionTracker;
                }
            }
            if ((StoreSettingInfo)Session["DefaultStoreSettings"] == null)
            {
                ASPXCommerceWebService aspxCommerceWebService = new ASPXCommerceWebService();
                StoreSettingInfo DefaultStoreSettings = aspxCommerceWebService.GetAllStoreSettings(GetStoreID, GetPortalID, GetCurrentCultureName);
                Session["DefaultStoreSettings"] = DefaultStoreSettings;
            }

        }
        catch
        {
        }
    }
Exemplo n.º 14
0
        protected void SucessFullLogin(UserInfo user)
        {
            RoleController role = new RoleController();

            Session[SessionKeys.LoginHitCount] = null;
            string userRoles = role.GetRoleIDs(user.UserName, GetPortalID);

            if (userRoles.Length > 0)
            {
                SetUserRoles(userRoles);
                MembershipController member = new MembershipController();
                user.LastLoginDate = DateTime.UtcNow;
                string prevLogin = member.UpdateUserLoginActivity(user);
                HttpContext.Current.Session[SessionKeys.Last_login_Date] = prevLogin;
                //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                //sessionTracker.PortalID = GetPortalID.ToString();
                //sessionTracker.Username = UserName.Text;
                //Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());
                StringBuilder             redirectURL = new StringBuilder();
                SecurityPolicy            objSecurity = new SecurityPolicy();
                FormsAuthenticationTicket ticket      = new FormsAuthenticationTicket(1,
                                                                                      user.UserName,
                                                                                      DateTime.Now,
                                                                                      DateTime.Now.AddMinutes(30),
                                                                                      true,
                                                                                      GetPortalID.ToString(),
                                                                                      FormsAuthentication.FormsCookiePath);

                // Encrypt the ticket.
                string encTicket = FormsAuthentication.Encrypt(ticket);
                //generate random cookieValue
                string randomCookieValue = GenerateRandomCookieValue();
                Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                //create new cookie with random cookie name and encrypted ticket
                HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                //get default time from  setting
                SageFrameConfig objConfig = new SageFrameConfig();
                string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                expiryTime = expiryTime < 5 ? 5 : expiryTime;
                //set cookie expiry time
                cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                //add cookie to the browser
                Response.Cookies.Add(cookie);
                string roleRedirectURL = string.Empty;
                roleRedirectURL = member.GetRedirectUrlByRoleID(userRoles);
                if (roleRedirectURL == string.Empty || roleRedirectURL == null)
                {
                    roleRedirectURL = PortalAPI.DefaultPageWithExtension;
                }
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    string PageNotFoundPage          = PortalAPI.PageNotFoundURLWithRoot;
                    string UserRegistrationPage      = PortalAPI.RegistrationURLWithRoot;
                    string PasswordRecoveryPage      = PortalAPI.PasswordRecoveryURLWithRoot;
                    string ForgotPasswordPage        = PortalAPI.ForgotPasswordURL;
                    string PageNotAccessiblePage     = PortalAPI.PageNotAccessibleURLWithRoot;
                    string ReturnUrlPage             = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();
                    bool   IsWellFormedReturnUrlPage = Uri.IsWellFormedUriString(ReturnUrlPage, UriKind.Absolute);
                    string RequestURL        = Request.Url.ToString();
                    Uri    RequestURLPageUri = new Uri(RequestURL);
                    string portalHostURL     = RequestURLPageUri.AbsolutePath.TrimStart('/');
                    if (IsWellFormedReturnUrlPage)
                    {
                        Uri    ReturnUrlPageUri = new Uri(ReturnUrlPage);
                        string ReturnURl        = ReturnUrlPageUri.Scheme + Uri.SchemeDelimiter + ReturnUrlPageUri.Host + ":" + ReturnUrlPageUri.Port;
                        string HostUrl          = GetHostURL();
                        Uri    uriHostURL       = new Uri(HostUrl);
                        Uri    uriReturnURL     = new Uri(ReturnURl);
                        var    resultCompareURL = Uri.Compare(uriHostURL, uriReturnURL,
                                                              UriComponents.Host | UriComponents.PathAndQuery,
                                                              UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                        int resultComparePortalURL = 0;
                        if (portalHostURL.ToLower().Contains("portal") && resultCompareURL == 0)
                        {
                            Uri      ReturnUrlPageHostUri     = new Uri(ReturnUrlPage);
                            string   portalReturnURL          = ReturnUrlPageHostUri.AbsolutePath.TrimStart('/');
                            string[] portalReturnURLSplit     = portalReturnURL.Split('/');
                            string   ReturnURLSplitPortal     = portalReturnURLSplit[0];
                            string   ReturnURLSplitPortalName = portalReturnURLSplit[1];
                            string   ReturnURLWithPortal      = ReturnURLSplitPortal + "/" + ReturnURLSplitPortalName;

                            string[] portalHostURLSplit     = portalHostURL.Split('/');
                            string   HostURLSplitPortal     = portalHostURLSplit[0];
                            string   HostURLSplitPortalName = portalHostURLSplit[1];
                            string   HostURLWithPortal      = HostURLSplitPortal + "/" + HostURLSplitPortalName;
                            resultComparePortalURL = string.Compare(ReturnURLWithPortal, HostURLWithPortal);
                        }
                        if (resultCompareURL != 0 || resultComparePortalURL != 0)
                        {
                            PageNotFoundURL();
                        }
                    }
                    else
                    {
                        PageNotFoundURL();
                    }

                    if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append(roleRedirectURL);
                    }
                    else
                    {
                        redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                    }
                }
                else
                {
                    if (!IsParent)
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append("/portal/");
                        redirectURL.Append(GetPortalSEOName);
                        redirectURL.Append("/");
                        redirectURL.Append(roleRedirectURL);
                    }
                    else
                    {
                        redirectURL.Append(GetParentURL);
                        // redirectURL.Append("/Webbuilder/");
                        redirectURL.Append("/");
                        redirectURL.Append(roleRedirectURL);
                    }
                }
                HttpContext.Current.Session[SessionKeys.IsLoginClick] = true;
                if (Session[SessionKeys.LoginHitCount] != null)
                {
                    HttpContext.Current.Session.Remove(SessionKeys.LoginHitCount);
                }
                Response.Redirect(redirectURL.ToString(), false);
            }
            else
            {
                FailureText.Text = string.Format("<span class='sfError'>{0}</span>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));//"You are not authenticated to this portal!";
            }
        }
Exemplo n.º 15
0
        private void LogInPublicModeRegistration(UserInfo user)
        {
            string strRoles = string.Empty;           
            RoleController role = new RoleController();
            SageFrameConfig sfConfig = new SageFrameConfig();
                
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                        sessionTracker.PortalID = GetPortalID.ToString();
                        sessionTracker.Username = user.UserName;
                        Session["Tracker"] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                        {
                            FormsAuthentication.SetAuthCookie(user.UserName, true);
                            bool IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                            if (IsUseFriendlyUrls)
                            {
                                if (GetPortalID > 1)
                                {
                                    Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"), false);
                                }
                                else
                                {
                                    Response.Redirect(ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"), false);
                                }
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                            }

                        }
                    }               

            
        }
Exemplo n.º 16
0
 private void SagePageLoadPart()
 {
     if (!IsPostBack)
     {
         string sageNavigateUrl = string.Empty;
         SageFrameConfig sfConfig = new SageFrameConfig();
         if (IsUseFriendlyUrls)
         {
             if (GetPortalID > 1)
             {
                 sageNavigateUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + Extension);
             }
             else
             {
                 sageNavigateUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + Extension);
             }
         }
         else
         {
             sageNavigateUrl = ResolveUrl("~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-"));
         }
         hypPreview.NavigateUrl = sageNavigateUrl;
         Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
         if (imgProgress != null)
         {
             imgProgress.ImageUrl = GetAdminImageUrl("ajax-loader.gif", true);
         }
     }
     SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
     if (string.IsNullOrEmpty(sessionTracker.PortalID))
     {
         sessionTracker.PortalID = GetPortalID.ToString();
         sessionTracker.Username = GetUsername;
         SageFrameConfig sfConfig = new SageFrameConfig();
         sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);
         SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
         SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
         Session[SessionKeys.Tracker] = sessionTracker;
     }
 }
Exemplo n.º 17
0
        private void SagePageLoadPart()
        {
            if (!IsPostBack)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalServicePath", " var aspxservicePath='" + ResolveUrl("~/") + "Modules/ASPXCommerce/ASPXCommerceServices/" + "';", true);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalRootPath", " var aspxRootPath='" + ResolveUrl("~/") + "';", true);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalTemplateFolderPath", " var aspxTemplateFolderPath='" + ResolveUrl("~/") + "Templates/" + TemplateName + "';", true);
            
                string sageRedirectPath = string.Empty;
                string sageNavigateUrl = string.Empty;
                SageFrameConfig sfConfig = new SageFrameConfig();
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        sageRedirectPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/");
                        sageNavigateUrl = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                    }
                    else
                    {
                        sageRedirectPath = ResolveUrl("~/");
                        sageNavigateUrl = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx");
                    }
                }
                else
                {
                    sageRedirectPath = ResolveUrl("{~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=");
                    sageNavigateUrl = ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                }
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "globalRedirectPath", " var aspxRedirectPath='" + sageRedirectPath + "';", true);

                hypHome.NavigateUrl = sageNavigateUrl;
                hypHome.Text = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
                hypHome.ImageUrl = GetTemplateImageUrl("home.png", true);
                hypPreview.NavigateUrl = hypHome.NavigateUrl;
                Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                bool IsAdmin = false;
                if (HttpContext.Current.User != null)
                {
                    MembershipUser user = Membership.GetUser();
                    if (user != null)
                    {
                        string[] sysRoles = SystemSetting.SYSTEM_SUPER_ROLES;
                        foreach (string role in sysRoles)
                        {
                            if (Roles.IsUserInRole(user.UserName, role))
                            {
                                IsAdmin = true;
                                break;
                            }
                        }
                    }
                }
                if (IsAdmin)
                {
                    divAdminControlPanel.Attributes.Add("style", "display:block");
                }
                else
                {
                    divAdminControlPanel.Attributes.Add("style", "display:none");
                }
            }
            SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
            if (string.IsNullOrEmpty(sessionTracker.PortalID))
            {
                sessionTracker.PortalID = GetPortalID.ToString();
                sessionTracker.Username = GetUsername;
                SageFrameConfig sfConfig = new SageFrameConfig();
                sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());                
                Session["Tracker"] = sessionTracker;
            }
        }
Exemplo n.º 18
0
    private void LogInPublicModeRegistration()
    {
        string strRoles = string.Empty;
        MembershipController member = new MembershipController();
        RoleController role = new RoleController();
        UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);

        if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
        {
            if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
            {
                string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                strRoles += userRoles;
                if (strRoles.Length > 0)
                {
                    SetUserRoles(strRoles);
                    SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                    sessionTracker.PortalID = GetPortalID.ToString();
                    sessionTracker.Username = UserName.Text;
                    Session["Tracker"] = sessionTracker;
                    SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                    SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                    {
                        FormsAuthentication.SetAuthCookie(UserName.Text, true);
                        bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                        if (IsUseFriendlyUrls)
                        {
                            if (GetPortalID > 1)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"), false);
                            }
                        }
                        else
                        {
                            Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                        }

                    }
                }

            }

        }
    }
	private void LogInPublicModeRegistration()
	{
		string strRoles = string.Empty;
		MembershipController member = new MembershipController();
		RoleController role = new RoleController();
		UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);

		if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
		{
			if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
			{
				string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
				strRoles += userRoles;
				if (strRoles.Length > 0)
				{
					SetUserRoles(strRoles);
                    //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                    //sessionTracker.PortalID = GetPortalID.ToString();
                    //sessionTracker.Username = UserName.Text;
                    //Session[SessionKeys.Tracker] = sessionTracker;
                    SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                    SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());
					{
						FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
								 user.UserName,
								 DateTime.Now,
								 DateTime.Now.AddMinutes(30),
								 true,
								 GetPortalID.ToString(),
								 FormsAuthentication.FormsCookiePath);

						// Encrypt the ticket.
						string encTicket = FormsAuthentication.Encrypt(ticket);

						// Create the cookie.
						Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
						bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
						if (IsUseFriendlyUrls)
						{
                            if (!IsParent)
							{
                                Response.Redirect(ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
							}
							else
							{
								Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
							}
						}
						else
						{
							Response.Redirect(ResolveUrl("~/Default"+SageFrameSettingKeys.PageExtension+"?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
						}

					}
				}

			}

		}
	}
Exemplo n.º 20
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {   
            MembershipController member=new MembershipController();
            RoleController role=new RoleController();
            UserInfo user=member.GetUserDetails(GetPortalID,UserName.Text);
            if (user.UserExists && user.IsApproved)
            {
                if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
                {
                    if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                    {
                        string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                        strRoles += userRoles;
                        if (strRoles.Length > 0)
                        {
                            SetUserRoles(strRoles);
                            SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                            sessionTracker.PortalID = GetPortalID.ToString();
                            sessionTracker.Username = UserName.Text;
                            Session["Tracker"] = sessionTracker;
                            SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                            SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());

                            if (Request.QueryString["ReturnUrl"] != null)
                            {

                                FormsAuthentication.SetAuthCookie(UserName.Text, RememberMe.Checked);
                                
                                string PageNotFoundPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx").Replace("\\", "/"); ;
                                string UserRegistrationPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalRegistrationPage) + ".aspx").Replace("\\", "/"); ;
                                string PasswordRecoveryPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalPasswordRecovery) + ".aspx").Replace("\\", "/"); ;
                                string ForgotPasswordPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalForgotPassword) + ".aspx").Replace("\\", "/"); ;
                                string PageNotAccessiblePage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx").Replace("\\", "/"); ;

                                string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                                if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                                {
                                    Response.Redirect("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx", false);
                                }
                                else
                                {
                                    Response.Redirect(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()), false);
                                }
                            }
                            else
                            {
                                FormsAuthentication.SetAuthCookie(UserName.Text, RememberMe.Checked);

                                if (IsUseFriendlyUrls)
                                {
                                    if (GetPortalID > 1)
                                    {
                                        Response.Redirect("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx", false);
                                    }
                                    else
                                    {
                                        Response.Redirect("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx", false);
                                    }
                                }
                                else
                                {
                                    Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                                }
                            }
                        }
                        else
                        {
                            FailureText.Text = GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal");//"You are not authenticated to this portal!";
                        }
                    }
                    else
                    {
                        FailureText.Text = GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched");//"Username and Password combination doesn't matched!";
                    }
                }
            }
            else
            {
                FailureText.Text = GetSageMessage("UserLogin", "UserDoesnotExist");
            }
        }
Exemplo n.º 21
0
        private void SagePageLoadPart()
        {
            try
            {
                CreateGlobalVariables();
                if (!IsPostBack)
                {


                    hypHome.NavigateUrl = sageNavigateUrl;
                    hypHome.Text = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
                    hypHome.ImageUrl = GetTemplateImageUrl("home.png", true);
                    hypPreview.NavigateUrl = hypHome.NavigateUrl;
                    Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                    if (imgProgress != null)
                    {
                        imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                    }

                }
                if ((SessionTracker)Session["Tracker"] != null)
                {
                    SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                    if (string.IsNullOrEmpty(sessionTracker.PortalID))
                    {
                        sessionTracker.PortalID = GetPortalID.ToString();
                        sessionTracker.Username = GetUsername;
                        SageFrameConfig sfConfig = new SageFrameConfig();
                        sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);

                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
                        SLog.StoreSessionTrackerAdd(sessionTracker, GetStoreID, GetPortalID);
                        Session["Tracker"] = sessionTracker;
                    }
                }
                //if ((StoreSettingInfo)Session["DefaultStoreSettings"] == null)
                //{
                //    AspxCommerceWebService AspxCommerceWebService = new AspxCommerceWebService();
                //    StoreSettingInfo DefaultStoreSettings = AspxCommerceWebService.GetAllStoreSettings(GetStoreID, GetPortalID, GetCurrentCultureName);
                //    Session["DefaultStoreSettings"] = DefaultStoreSettings;
                //}

            }
            catch
            {
            }
        }
Exemplo n.º 22
0
        protected void SucessFullLogin(UserInfo user)
        {
            RoleController role = new RoleController();
            Session[SessionKeys.LoginHitCount] = null;
            string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                //sessionTracker.PortalID = GetPortalID.ToString();
                //sessionTracker.Username = UserName.Text;
                //Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());
                StringBuilder redirectURL = new StringBuilder();
                SecurityPolicy objSecurity = new SecurityPolicy();
                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                        user.UserName,
                        DateTime.Now,
                        DateTime.Now.AddMinutes(30),
                        true,
                        GetPortalID.ToString(),
                        FormsAuthentication.FormsCookiePath);

                // Encrypt the ticket.
                string encTicket = FormsAuthentication.Encrypt(ticket);
                //generate random cookieValue
                string randomCookieValue = GenerateRandomCookieValue();
                Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                //create new cookie with random cookie name and encrypted ticket
                HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                //get default time from  setting
                SageFrameConfig objConfig = new SageFrameConfig();
                string ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                int expiryTime = Math.Abs(int.Parse(ServerCookieExpiration));
                expiryTime = expiryTime < 5 ? 5 : expiryTime;
                //set cookie expiry time
                cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                //add cookie to the browser
                Response.Cookies.Add(cookie);
                ServiceSecurity.IssueToken(GetPortalID);

                if (Request.QueryString["ReturnUrl"] != null)
                {
                    string PageNotFoundPage = PortalAPI.PageNotFoundURLWithRoot;
                    string UserRegistrationPage = PortalAPI.RegistrationURLWithRoot;
                    string PasswordRecoveryPage = PortalAPI.PasswordRecoveryURLWithRoot;
                    string ForgotPasswordPage = PortalAPI.ForgotPasswordURL;
                    string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;
                    string ReturnUrlPage = string.Empty;
                    if (Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString().Contains(GetHostURL()))
                    {
                         ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();
                    }
                    else
                    {
                         ReturnUrlPage = GetHostURL() + Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();
                    }
                      string RequestURL = Request.Url.ToString();
                    Uri RequestURLPageUri = new Uri(RequestURL);
                    string portalHostURL = RequestURLPageUri.AbsolutePath.TrimStart('/');
                    if (GetApplicationName==string.Empty)
                    {
                    bool IsWellFormedReturnUrlPage = Uri.IsWellFormedUriString(ReturnUrlPage, UriKind.Absolute);

                    
                        if (IsWellFormedReturnUrlPage)
                        {
                            Uri ReturnUrlPageUri = new Uri(ReturnUrlPage);
                            string ReturnURl = ReturnUrlPageUri.Scheme + Uri.SchemeDelimiter + ReturnUrlPageUri.Host + ":" + ReturnUrlPageUri.Port;
                            string HostUrl = GetHostURL();
                            Uri uriHostURL = new Uri(HostUrl);
                            Uri uriReturnURL = new Uri(ReturnURl);
                            var resultCompareURL = Uri.Compare(uriHostURL, uriReturnURL,
                                UriComponents.Host | UriComponents.PathAndQuery,
                                UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                            int resultComparePortalURL = 0;
                            if (portalHostURL.ToLower().Contains("portal") && resultCompareURL == 0)
                            {
                                Uri ReturnUrlPageHostUri = new Uri(ReturnUrlPage);
                                string portalReturnURL = ReturnUrlPageHostUri.AbsolutePath.TrimStart('/');
                                string[] portalReturnURLSplit = portalReturnURL.Split('/');
                                string ReturnURLSplitPortal = portalReturnURLSplit[0];
                                string ReturnURLSplitPortalName = portalReturnURLSplit[1];
                                string ReturnURLWithPortal = ReturnURLSplitPortal + "/" + ReturnURLSplitPortalName;

                                string[] portalHostURLSplit = portalHostURL.Split('/');
                                string HostURLSplitPortal = portalHostURLSplit[0];
                                string HostURLSplitPortalName = portalHostURLSplit[1];
                                string HostURLWithPortal = HostURLSplitPortal + "/" + HostURLSplitPortalName;
                                resultComparePortalURL = string.Compare(ReturnURLWithPortal, HostURLWithPortal);
                            }
                            if (resultCompareURL != 0 || resultComparePortalURL != 0)
                            {
                                PageNotFoundURL();
                            }
                        }
                        else
                        {
                            PageNotFoundURL();
                        }
                    }

                    if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                    }
                }
                else
                {
                    if (!IsParent)
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append("/portal/");
                        redirectURL.Append(GetPortalSEOName);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                }
                HttpContext.Current.Session[SessionKeys.IsLoginClick] = true;
                if (Session[SessionKeys.LoginHitCount] != null)
                {
                    HttpContext.Current.Session.Remove(SessionKeys.LoginHitCount);
                }
                Response.Redirect(redirectURL.ToString(), false);
            }
            else
            {
                FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));//"You are not authenticated to this portal!";
            }
        }
Exemplo n.º 23
0
 private void SagePageLoadPart()
 {
     LoadGlobalVariables();
     if (!IsPostBack)
     {
         hypHome.NavigateUrl = sageNavigateUrl;
         hypHome.Text = sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
         hypHome.ImageUrl = GetTemplateImageUrl("home.png", true);
         hypPreview.NavigateUrl = hypHome.NavigateUrl;
         Image imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
         if (imgProgress != null)
         {
             imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
         }
         bool IsAdmin = false;
         if (HttpContext.Current.User != null)
         {
             MembershipUser user = Membership.GetUser();
             if (user != null)
             {
                 string[] sysRoles = SystemSetting.SYSTEM_SUPER_ROLES;
                 foreach (string role in sysRoles)
                 {
                     if (Roles.IsUserInRole(user.UserName, role))
                     {
                         IsAdmin = true;
                         break;
                     }
                 }
             }
         }
         if (IsAdmin)
         {
             divAdminControlPanel.Attributes.Add("style", "display:block");
         }
         else
         {
             divAdminControlPanel.Attributes.Add("style", "display:none");
         }
         Session["payMentGateWayRefresh"] = Server.UrlEncode(System.DateTime.Now.ToString());
     }
     SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
     if (string.IsNullOrEmpty(sessionTracker.PortalID))
     {
         sessionTracker.PortalID = GetPortalID.ToString();
         sessionTracker.Username = GetUsername;
         SageFrameConfig sfConfig = new SageFrameConfig();
         sessionTracker.InsertSessionTrackerPages = sfConfig.GetSettingsByKey(SageFrameSettingKeys.InsertSessionTrackingPages);
         SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
         SLog.SessionTrackerUpdateUsername(sessionTracker, GetUsername, GetPortalID.ToString());
         Session["Tracker"] = sessionTracker;
     }
 }
Exemplo n.º 24
0
        protected void SucessFullLogin(UserInfo user)
        {
            RoleController role = new RoleController();
            Session[SessionKeys.LoginHitCount] = null;
            string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                sessionTracker.PortalID = GetPortalID.ToString();
                sessionTracker.Username = UserName.Text;
                Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                StringBuilder redirectURL = new StringBuilder();
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                      user.UserName,
                      DateTime.Now,
                      DateTime.Now.AddMinutes(30),
                      true,
                      GetPortalID.ToString(),
                      FormsAuthentication.FormsCookiePath);
                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);
                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    string PageNotFoundPage = PortalAPI.PageNotFoundURLWithRoot;
                    string UserRegistrationPage = PortalAPI.RegistrationURLWithRoot;
                    string PasswordRecoveryPage = PortalAPI.PasswordRecoveryURLWithRoot;
                    string ForgotPasswordPage = PortalAPI.ForgotPasswordURL;
                    string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                    string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                    if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                    {
                        redirectURL.Append("~/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                    }
                }
                else
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                     user.UserName,
                     DateTime.Now,
                     DateTime.Now.AddMinutes(30),
                     true,
                     GetPortalID.ToString(),
                     FormsAuthentication.FormsCookiePath);

                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);

                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    if (GetPortalID > 1)
                    {
                        redirectURL.Append("~/portal/");
                        redirectURL.Append(GetPortalSEOName);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append("~/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                }
                HttpContext.Current.Session["IsLoginClick" + user.UserName] = true;
                Response.Redirect(redirectURL.ToString(), false);

            }
            else
            {
                FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));//"You are not authenticated to this portal!";
            }
        }
        private void LogInPublicModeRegistration()
        {
            string strRoles             = string.Empty;
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text.Trim());

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //sessionTracker.PortalID = GetPortalID.ToString();
                        //sessionTracker.Username = UserName.Text;
                        //Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog       = new SageFrame.Web.SessionLog();
                        SageFrameConfig          SageConfig = new SageFrameConfig();
                        SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
                        bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.EnableSessionTracker));
                        if (EnableSessionTracker)
                        {
                            SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());
                        }
                        {
                            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                             user.UserName,
                                                                                             DateTime.Now,
                                                                                             DateTime.Now.AddMinutes(30),
                                                                                             true,
                                                                                             GetPortalID.ToString(),
                                                                                             FormsAuthentication.FormsCookiePath);

                            StoreSettingConfig ssc = new StoreSettingConfig();


                            if (ssc.GetStoreSettingsByKey(StoreSetting.AllowRealTimeNotifications, GetStoreID, GetPortalID, GetCurrentCultureName).ToLower() == "true")
                            {
                                RealTimeHelper.UpdateAdminNotifications(GetStoreID, GetPortalID);
                            }


                            // Encrypt the ticket.
                            string encTicket = FormsAuthentication.Encrypt(ticket);

                            // Create the cookie.
                            string randomCookieValue = GenerateRandomCookieValue();
                            Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                            SecurityPolicy  objSecurity            = new SecurityPolicy();
                            HttpCookie      cookie                 = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                            SageFrameConfig objConfig              = new SageFrameConfig();
                            string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                            int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                            expiryTime     = expiryTime < 5 ? 5 : expiryTime;
                            cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                            Response.Cookies.Add(cookie);
                            string sessionCode = string.Empty;
                            ServiceSecurity.IssueToken(GetPortalID);
                            if (HttpContext.Current.Session.SessionID != null)
                            {
                                sessionCode = HttpContext.Current.Session.SessionID.ToString();
                            }
                            int CustomerID = GetUserDetailsByUserName(UserName.Text, GetPortalID).CustomerID;
                            UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, CustomerID, sessionCode);
                            if (!IsParent)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                        }
                    }
                }
            }
        }
 private void LogInPublicModeRegistration(UserInfo user)
 {
     string strRoles = string.Empty;
     RoleController role = new RoleController();
     SageFrameConfig sfConfig = new SageFrameConfig();
     string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
     strRoles += userRoles;
     if (strRoles.Length > 0)
     {
         SetUserRoles(strRoles);
         //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
         //sessionTracker.PortalID = GetPortalID.ToString();
         //sessionTracker.Username = user.UserName;
         //Session[SessionKeys.Tracker] = sessionTracker;
         SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
         SageFrameConfig SageConfig = new SageFrameConfig();
         SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
         bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.EnableSessionTracker));
         if (EnableSessionTracker)
         {
             SLog.SessionTrackerUpdateUsername(user.UserName, GetPortalID.ToString());
         }
         {
             FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                 user.UserName,
                 DateTime.Now,
                 DateTime.Now.AddMinutes(30),
                 true,
                 GetPortalID.ToString(),
                 FormsAuthentication.FormsCookiePath);
             // Encrypt the ticket.
             string encTicket = FormsAuthentication.Encrypt(ticket);
             // Create the cookie.
             SecurityPolicy objSecurity = new SecurityPolicy();
             Response.Cookies.Add(new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket));
             if (!IsParent)
             {
                 Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
             }
             else
             {
                 Response.Redirect(ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
             }
         }
     }
 }
Exemplo n.º 27
0
        protected void SucessFullLogin(UserInfo user)
        {
            RoleController role = new RoleController();

            Session[SessionKeys.LoginHitCount] = null;
            string userRoles = role.GetRoleNames(user.UserName, GetPortalID);

            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                sessionTracker.PortalID      = GetPortalID.ToString();
                sessionTracker.Username      = UserName.Text;
                Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                StringBuilder             redirectURL = new StringBuilder();
                SecurityPolicy            objSecurity = new SecurityPolicy();
                FormsAuthenticationTicket ticket      = new FormsAuthenticationTicket(1,
                                                                                      user.UserName,
                                                                                      DateTime.Now,
                                                                                      DateTime.Now.AddMinutes(30),
                                                                                      true,
                                                                                      GetPortalID.ToString(),
                                                                                      FormsAuthentication.FormsCookiePath);

                // Encrypt the ticket.
                string encTicket = FormsAuthentication.Encrypt(ticket);

                //generate random cookieValue
                string randomCookieValue = GenerateRandomCookieValue();
                Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                //create new cookie with random cookie name and encrypted ticket
                HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                //get default time from  setting
                SageFrameConfig objConfig = new SageFrameConfig();
                string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                expiryTime = expiryTime < 5 ? 5 : expiryTime;
                //set cookie expiry time
                cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                //add cookie to the browser
                Response.Cookies.Add(cookie);
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    string PageNotFoundPage      = PortalAPI.PageNotFoundURLWithRoot;
                    string UserRegistrationPage  = PortalAPI.RegistrationURLWithRoot;
                    string PasswordRecoveryPage  = PortalAPI.PasswordRecoveryURLWithRoot;
                    string ForgotPasswordPage    = PortalAPI.ForgotPasswordURL;
                    string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                    string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                    if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                    }
                }
                else
                {
                    if (!IsParent)
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append("/portal/");
                        redirectURL.Append(GetPortalSEOName);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(GetParentURL);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                }
                HttpContext.Current.Session["IsLoginClick" + user.UserName] = true;
                Response.Redirect(redirectURL.ToString(), false);
            }
            else
            {
                FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));//"You are not authenticated to this portal!";
            }
        }
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        MembershipController member = new MembershipController();
        RoleController role = new RoleController();
        UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);
        if (user.UserExists && user.IsApproved)
        {
            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(PasswordAspx.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, PasswordAspx.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //sessionTracker.PortalID = GetPortalID.ToString();
                        //sessionTracker.Username = UserName.Text;
                        //Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());

                        StringBuilder redirectURL = new StringBuilder();
                        SecurityPolicy objSecurity = new SecurityPolicy();
                        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                          user.UserName,
                          DateTime.Now,
                          DateTime.Now.AddMinutes(30),
                          true,
                          GetPortalID.ToString(),
                          FormsAuthentication.FormsCookiePath);

                        string encTicket = FormsAuthentication.Encrypt(ticket);

                        string randomCookieValue = GenerateRandomCookieValue();
                        Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                        HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                        SageFrameConfig objConfig = new SageFrameConfig();
                        string ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                        int expiryTime = Math.Abs(int.Parse(ServerCookieExpiration));
                        expiryTime = expiryTime < 5 ? 5 : expiryTime;
                        cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                        Response.Cookies.Add(cookie);
                        ServiceSecurity.IssueToken(GetPortalID);
                        if (Request.QueryString["ReturnUrl"] != null)
                        {
                            string PageNotFoundPage = PortalAPI.PageNotFoundURLWithRoot;
                            string UserRegistrationPage = PortalAPI.RegistrationURLWithRoot;
                            string PasswordRecoveryPage = PortalAPI.PasswordRecoveryURLWithRoot;
                            string ForgotPasswordPage = PortalAPI.ForgotPasswordURL;
                            string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                            string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                            if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                            }
                            else
                            {
                                redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                            }
                        }
                        else
                        {




                            if (!IsParent)
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append("/portal/");
                                redirectURL.Append(GetPortalSEOName);
                                redirectURL.Append("/");
                                redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName));
                                redirectURL.Append(SageFrameSettingKeys.PageExtension);
                            }
                            else
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append("/");
                                redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName));
                                redirectURL.Append(SageFrameSettingKeys.PageExtension);
                            }

                        }

                        int customerID = GetCustomerID;
                        if (customerID == 0)
                        {
                            CustomerGeneralInfo sageUserCust = CustomerGeneralInfoController.CustomerIDGetByUsername(user.UserName, storeID, portalID);
                            if (sageUserCust != null)
                            {
                                customerID = sageUserCust.CustomerID;
                            }
                        }
                        AspxCommonController objCommonCont = new AspxCommonController();
                        objCommonCont.UpdateCartAnonymoususertoRegistered(storeID, portalID, customerID, sessionCode);
                        Response.Redirect(redirectURL.ToString(), false);
                    }
                    else
                    {
                        FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));
                    }
                }
                else
                {
                    FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!";
                }
            }
        }
        else
        {
            FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UserDoesnotExist"));
        }
    }
 private void LogInPublicModeRegistration(UserInfo user)
 {
     string strRoles = string.Empty;
     RoleController role = new RoleController();
     SageFrameConfig sfConfig = new SageFrameConfig();
     string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
     strRoles += userRoles;
     if (strRoles.Length > 0)
     {
         SetUserRoles(strRoles);
         SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
         sessionTracker.PortalID = GetPortalID.ToString();
         sessionTracker.Username = user.UserName;
         Session[SessionKeys.Tracker] = sessionTracker;
         SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
         SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
         {
             FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                 user.UserName,
                 DateTime.Now,
                 DateTime.Now.AddMinutes(30),
                 true,
                 GetPortalID.ToString(),
                 FormsAuthentication.FormsCookiePath);
             // Encrypt the ticket.
             string encTicket = FormsAuthentication.Encrypt(ticket);
             // Create the cookie.
             Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
             bool IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
             if (IsUseFriendlyUrls)
             {
                 if (GetPortalID > 1)
                 {
                     Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
                 }
                 else
                 {
                     Response.Redirect(ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
                 }
             }
             else
             {
                 Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
             }
         }
     }
 }
        private void LogInPublicModeRegistration()
        {
            string strRoles = string.Empty;
            MembershipController member = new MembershipController();
            RoleController role = new RoleController();
            UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text.Trim());

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //sessionTracker.PortalID = GetPortalID.ToString();
                        //sessionTracker.Username = UserName.Text;
                        //Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SageFrameConfig SageConfig = new SageFrameConfig();
                        SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
                        bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.EnableSessionTracker));
                        if (EnableSessionTracker)
                        {
                            SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());
                        }
                        {
                            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                  user.UserName,
                                  DateTime.Now,
                                  DateTime.Now.AddMinutes(30),
                                  true,
                                  GetPortalID.ToString(),
                                  FormsAuthentication.FormsCookiePath);

                            StoreSettingConfig ssc = new StoreSettingConfig();


                            if (ssc.GetStoreSettingsByKey(StoreSetting.AllowRealTimeNotifications, GetStoreID, GetPortalID, GetCurrentCultureName).ToLower() == "true")
                            {
                                RealTimeHelper.UpdateAdminNotifications(GetStoreID, GetPortalID);    
                            }
                            

                            // Encrypt the ticket.
                            string encTicket = FormsAuthentication.Encrypt(ticket);

                            // Create the cookie.
                            string randomCookieValue = GenerateRandomCookieValue();
                            Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                            SecurityPolicy objSecurity = new SecurityPolicy();
                            HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                            SageFrameConfig objConfig = new SageFrameConfig();
                            string ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                            int expiryTime = Math.Abs(int.Parse(ServerCookieExpiration));
                            expiryTime = expiryTime < 5 ? 5 : expiryTime;
                            cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                            Response.Cookies.Add(cookie);
                            string sessionCode = string.Empty;
                            ServiceSecurity.IssueToken(GetPortalID);
                            if (HttpContext.Current.Session.SessionID != null)
                            {
                                sessionCode = HttpContext.Current.Session.SessionID.ToString();
                            }
                            int CustomerID = GetUserDetailsByUserName(UserName.Text,GetPortalID).CustomerID;
                            UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, CustomerID, sessionCode);
                            if (!IsParent)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 31
0
        protected void SucessFullLogin(UserInfo user)
        {
            RoleController role = new RoleController();

            Session[SessionKeys.LoginHitCount] = null;
            string userRoles = role.GetRoleNames(user.UserName, GetPortalID);

            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                sessionTracker.PortalID      = GetPortalID.ToString();
                sessionTracker.Username      = UserName.Text;
                Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                StringBuilder redirectURL = new StringBuilder();
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     user.UserName,
                                                                                     DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(30),
                                                                                     true,
                                                                                     GetPortalID.ToString(),
                                                                                     FormsAuthentication.FormsCookiePath);
                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);
                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    string PageNotFoundPage      = PortalAPI.PageNotFoundURLWithRoot;
                    string UserRegistrationPage  = PortalAPI.RegistrationURLWithRoot;
                    string PasswordRecoveryPage  = PortalAPI.PasswordRecoveryURLWithRoot;
                    string ForgotPasswordPage    = PortalAPI.ForgotPasswordURL;
                    string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                    string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                    if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                    {
                        redirectURL.Append("~/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                    }
                }
                else
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     user.UserName,
                                                                                     DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(30),
                                                                                     true,
                                                                                     GetPortalID.ToString(),
                                                                                     FormsAuthentication.FormsCookiePath);

                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);

                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    if (GetPortalID > 1)
                    {
                        redirectURL.Append("~/portal/");
                        redirectURL.Append(GetPortalSEOName);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append("~/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                }
                HttpContext.Current.Session["IsLoginClick" + user.UserName] = true;
                Response.Redirect(redirectURL.ToString(), false);
            }
            else
            {
                FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));//"You are not authenticated to this portal!";
            }
        }
Exemplo n.º 32
0
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        MembershipController member = new MembershipController();
        RoleController       role   = new RoleController();
        UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text);

        if (user.UserExists && user.IsApproved)
        {
            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(PasswordAspx.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, PasswordAspx.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //sessionTracker.PortalID = GetPortalID.ToString();
                        //sessionTracker.Username = UserName.Text;
                        //Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());

                        StringBuilder             redirectURL = new StringBuilder();
                        SecurityPolicy            objSecurity = new SecurityPolicy();
                        FormsAuthenticationTicket ticket      = new FormsAuthenticationTicket(1,
                                                                                              user.UserName,
                                                                                              DateTime.Now,
                                                                                              DateTime.Now.AddMinutes(30),
                                                                                              true,
                                                                                              GetPortalID.ToString(),
                                                                                              FormsAuthentication.FormsCookiePath);

                        string encTicket = FormsAuthentication.Encrypt(ticket);

                        string randomCookieValue = GenerateRandomCookieValue();
                        Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                        HttpCookie      cookie    = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                        SageFrameConfig objConfig = new SageFrameConfig();
                        string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                        int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                        expiryTime     = expiryTime < 5 ? 5 : expiryTime;
                        cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                        Response.Cookies.Add(cookie);
                        ServiceSecurity.IssueToken(GetPortalID);
                        if (Request.QueryString["ReturnUrl"] != null)
                        {
                            string PageNotFoundPage      = PortalAPI.PageNotFoundURLWithRoot;
                            string UserRegistrationPage  = PortalAPI.RegistrationURLWithRoot;
                            string PasswordRecoveryPage  = PortalAPI.PasswordRecoveryURLWithRoot;
                            string ForgotPasswordPage    = PortalAPI.ForgotPasswordURL;
                            string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                            string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                            if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                            }
                            else
                            {
                                redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                            }
                        }
                        else
                        {
                            if (!IsParent)
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append("/portal/");
                                redirectURL.Append(GetPortalSEOName);
                                redirectURL.Append("/");
                                redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName));
                                redirectURL.Append(SageFrameSettingKeys.PageExtension);
                            }
                            else
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append("/");
                                redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName));
                                redirectURL.Append(SageFrameSettingKeys.PageExtension);
                            }
                        }

                        int customerID = GetCustomerID;
                        if (customerID == 0)
                        {
                            CustomerGeneralInfo sageUserCust = CustomerGeneralInfoController.CustomerIDGetByUsername(user.UserName, storeID, portalID);
                            if (sageUserCust != null)
                            {
                                customerID = sageUserCust.CustomerID;
                            }
                        }
                        AspxCommonController objCommonCont = new AspxCommonController();
                        objCommonCont.UpdateCartAnonymoususertoRegistered(storeID, portalID, customerID, sessionCode);
                        Response.Redirect(redirectURL.ToString(), false);
                    }
                    else
                    {
                        FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));
                    }
                }
                else
                {
                    FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!";
                }
            }
        }
        else
        {
            FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UserDoesnotExist"));
        }
    }