public static string IssueToken(int portalID)
 {
     string token = "";
     string uniqueId = Guid.NewGuid().ToString();
     RoleController role = new RoleController();
     string roles = role.GetRoleNames(GetUser(portalID), portalID).ToLower(); //.Split(',');
     SecurityPolicy objSecurity = new SecurityPolicy();
     string authcookie = objSecurity.FormsCookieName(portalID);
     string auth = IsUserLoggedIn(portalID) ? authcookie : "anonymoususer";
     string timestamp = DateTime.Now.ToString("yyyyMMddHHmmssffff");
     token = uniqueId + ":" + auth + ":" + timestamp;
     HttpContext.Current.Session["Auth_Token"] = token;
     return token;
 }
 private void RestartApplication()
 {
     SageFrame.Application.Application app = new SageFrame.Application.Application();
     File.SetLastWriteTime((app.ApplicationMapPath + "\\web.config"), System.DateTime.Now);
     SecurityPolicy objSecurity = new SecurityPolicy();
     HttpCookie authenticateCookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID));
     authenticateCookie.Expires = DateTime.Now.AddYears(-1);
     Response.Cookies.Add(authenticateCookie);
     System.Web.Security.FormsAuthentication.SignOut();
     SetUserRoles(string.Empty);
     string redUrl = string.Empty;
     SageFrameConfig sfConfig = new SageFrameConfig();
     if (!IsParent)
     {
         redUrl = GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension;
     }
     else
     {
         redUrl = GetParentURL + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension;
     }
     Response.Redirect(redUrl);
 }
        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.º 4
0
 private void SetAdminParts()
 {
     SecurityPolicy objSecurity = new SecurityPolicy();
     HttpCookie authCookie = Request.Cookies[objSecurity.FormsCookieName(GetPortalID)];
     if (authCookie != null)
     {
         RoleController _role = new RoleController();
         bool isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID);
         if (isDashboardAccessible)
         {
             divAdminControlPanel.Visible = true;
             ApplicationController objAppController = new ApplicationController();
             // objAppController.ChangeCss(Page, "pchWhole", "lytA", "sfOuterWrapper", "style", "margin-top:30px");
         }
     }
     else
     {
         divAdminControlPanel.Visible = false;
     }
     if (IsHandheld())
     {
         divAdminControlPanel.Visible = false;
     }
 }
Exemplo n.º 5
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!";
            }
        }
    protected void lnkloginStatus_Click(object sender, EventArgs e)
    {
        try
        {
   
            SageFrameConfig SageConfig = new SageFrameConfig();
            SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
            bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingsByKey(SageFrameSettingKeys.EnableSessionTracker));

            SessionTracker sessionTrackerNew = new SessionTracker();
            if (EnableSessionTracker)
            {
                string sessionID = HttpContext.Current.Session.SessionID;
                SageFrame.Web.SessionLog sLogNew = new SageFrame.Web.SessionLog();
                sLogNew.SessionLogStart(sessionTrackerNew, sessionID);
            }           
            string ReturnUrl = string.Empty;
            string RedUrl = string.Empty;
            SageFrameConfig sfConfig = new SageFrameConfig();
            if (lnkloginStatus.CommandName == "LOGIN")
            {

                if (Request.QueryString["ReturnUrl"] == null)
                {
                    ReturnUrl = Request.RawUrl.ToString();
                    if (!(ReturnUrl.ToLower().Contains(SageFrameSettingKeys.PageExtension)))
                    {
                        //ReturnUrl = ReturnUrl.Remove(strURL.LastIndexOf('/'));
                        if (ReturnUrl.EndsWith("/"))
                        {
                            ReturnUrl += sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                        }
                        else
                        {
                            ReturnUrl += '/' + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                        }
                    }
                }
                else
                {
                    ReturnUrl = Request.QueryString["ReturnUrl"].ToString();
                }
                if (!IsParent)
                {
                    RedUrl = GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;

                }
                else
                {
                    RedUrl = GetParentURL + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;
                }

            }
            else
            {

                if (EnableSessionTracker)
                {
                    SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
                    sLog.SessionLogEnd(GetPortalID);
                }

                SecurityPolicy objSecurity = new SecurityPolicy();
                HttpCookie authenticateCookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID));
                authenticateCookie.Expires = DateTime.Now.AddYears(-1);
                string randomCookieValue = GenerateRandomCookieValue();
                HttpContext.Current.Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                Response.Cookies.Add(authenticateCookie);
                lnkloginStatus.Text = "Login";
                SetUserRoles(string.Empty);
                //create new sessionID
                SessionIDManager manager = new SessionIDManager();
                manager.RemoveSessionID(System.Web.HttpContext.Current);
                var newId = manager.CreateSessionID(System.Web.HttpContext.Current);
                var isRedirected = true;
                var isAdded = true;
                manager.SaveSessionID(System.Web.HttpContext.Current, newId, out isRedirected, out isAdded);

                if (!IsParent)
                {
                    RedUrl = GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                }
                else
                {
                    RedUrl = GetParentURL + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                }
            }
            CheckOutHelper cHelper = new CheckOutHelper();
            cHelper.ClearSessions();            

            FormsAuthentication.SignOut();
            Response.Redirect(RedUrl, false);
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
    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();
         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);
             }
         }
     }
 }