Exemplo n.º 1
0
    protected void lnkloginStatus_Click(object sender, EventArgs e)
    {
        SageFrameConfig SageConfig = new SageFrameConfig();

        SageFrameSettingKeys.PageExtension = SageConfig.GetSettingsByKey(SageFrameSettingKeys.SettingPageExtension);
        bool EnableSessionTracker = bool.Parse(SageConfig.GetSettingsByKey(SageFrameSettingKeys.EnableSessionTracker));

        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);
        SetUserRoles(string.Empty);
        HttpContext.Current.Session[SessionKeys.ModuleCss] = new List <CssScriptInfo>();
        HttpContext.Current.Session[SessionKeys.ModuleJs]  = new List <CssScriptInfo>();
        Response.Redirect(GetHostURL() + "/" + tempPageName.Replace(" ", "-"));
    }
Exemplo n.º 2
0
 protected void Session_End(object sender, EventArgs e)
 {
     try
     {
         SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
         if ((sessionTracker == null))
         {
             return;
         }
         else
         {
             SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
             sLog.SessionLogEnd(sessionTracker);
         }
     }
     catch
     {
     }
 }
    protected void lnkloginStatus_Click(object sender, EventArgs e)
    {
        try
        {
            ///Update the Session Tracker
            SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
            if (sessionTracker != null)
            {
                SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
                sLog.SessionLogEnd(sessionTracker);
            }
            SessionTracker sessionTrackerNew = new SessionTracker();
            if (sessionTrackerNew != null)
            {
                SageFrame.Web.SessionLog sLogNew = new SageFrame.Web.SessionLog();
                sLogNew.SessionLogStart(sessionTrackerNew);
            }
            HttpContext.Current.Session[SessionKeys.Tracker] = sessionTrackerNew;
            string          ReturnUrl = string.Empty;
            string          RedUrl    = string.Empty;
            SageFrameConfig sfConfig  = new SageFrameConfig();
            if (lnkloginStatus.CommandName == "LOGIN")
            {
                if (IsUseFriendlyUrls)
                {
                    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 (GetPortalID > 1)
                    {
                        RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;
                    }
                    else
                    {
                        RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;
                    }
                }
                else
                {
                    string[] arrUrl;
                    string   strURL = string.Empty;
                    arrUrl = Request.RawUrl.Split('?');
                    string[] keys = Request.QueryString.AllKeys;
                    for (int i = 0; i < Request.QueryString.Count; i++)
                    {
                        string[] values = Request.QueryString.GetValues(i);
                        strURL += keys[i] + '=' + values[0] + '&';
                    }
                    if (strURL.Length > 0)
                    {
                        strURL = strURL.Remove(strURL.LastIndexOf('&'));
                    }
                    ReturnUrl = arrUrl[0] + Server.UrlEncode(strURL.Length > 0 ? "?" + strURL : "");
                    RedUrl    = "~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + "&ReturnUrl=" + ReturnUrl;
                }
            }
            else
            {
                //                FormsAuthentication.SignOut();
                HttpCookie authenticateCookie = new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID);
                authenticateCookie.Expires = DateTime.Now.AddYears(-1);
                Response.Cookies.Add(authenticateCookie);
                lnkloginStatus.Text = "Login";
                SetUserRoles(string.Empty);
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                    }
                    else
                    {
                        RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                    }
                }
                else
                {
                    RedUrl = "~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-");
                }
            }

            Response.Redirect(RedUrl, false);
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Exemplo n.º 4
0
        protected void Session_End(object sender, EventArgs e)
        {
            try
            {
                 SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                if ((sessionTracker == null))
                {
                    return;
                }
                else
                {
                    SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
                    sLog.SessionLogEnd(sessionTracker);
                }

            }
            catch
            {
            }
        }
        protected void Session_End(object sender, EventArgs e)
        {
            try
            {
                SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                FormsAuthentication.SignOut();
                if ((sessionTracker == null))
                {
                    return;
                }
                else
                {
                    SessionLog sLog = new SessionLog();
                    sLog.SessionLogEnd(sessionTracker);
                }

            }
            catch
            {
            }
            if (HttpContext.Current != null)
            {
                if (null != HttpContext.Current.Session)
                    HttpContext.Current.Session.Abandon();
            }

        }
    protected void lnkloginStatus_Click(object sender, EventArgs e)
    {
        try
        {
            ///Update the Session Tracker
            //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
            //if (sessionTracker != null)
            //{
            //    SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
            //    sLog.SessionLogEnd(sessionTracker);
            //}
            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.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;
                }
                else
                {
                    RedUrl = GetParentURL + "/" + sfConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;
                }
                string strCurrentURL = Request.Url.ToString();
                if (RedUrl.ToString().Contains("?"))
                {
                    RedUrl += "&ReturnUrl=";
                    RedUrl += strCurrentURL;
                }
                else
                {
                    RedUrl += "?ReturnUrl=";
                    RedUrl += strCurrentURL;
                }
            }
            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);
                if (!IsParent)
                {
                    RedUrl = GetParentURL + "/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-");
                }
                else
                {
                    RedUrl = GetParentURL + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-");
                }
            }
            FormsAuthentication.SignOut();
            Response.Redirect(RedUrl, false);
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
Exemplo n.º 7
0
    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);
        }
    }
Exemplo n.º 8
0
        protected void lnkloginStatus_Click(object sender, EventArgs e)
        {
            try
            {
                ///Update the Session Tracker
                SessionTracker           sessionTracker = (SessionTracker)Session["Tracker"];
                SageFrame.Web.SessionLog sLog           = new SageFrame.Web.SessionLog();
                sLog.SessionLogEnd(sessionTracker);

                SessionTracker sessionTrackerNew = new SessionTracker();
                if (sessionTrackerNew != null)
                {
                    SageFrame.Web.SessionLog sLogNew = new SageFrame.Web.SessionLog();
                    sLogNew.SessionLogStart(sessionTrackerNew);
                }
                HttpContext.Current.Session["Tracker"] = sessionTrackerNew;


                string          ReturnUrl = string.Empty;
                string          RedUrl    = string.Empty;
                SageFrameConfig sfConfig  = new SageFrameConfig();
                if (lnkloginStatus.CommandName == "LOGIN")
                {
                    if (IsUseFriendlyUrls)
                    {
                        if (Request.QueryString["ReturnUrl"] == null)
                        {
                            ReturnUrl = Request.RawUrl.ToString();
                            if (!(ReturnUrl.ToLower().Contains(".aspx")))
                            {
                                //ReturnUrl = ReturnUrl.Remove(strURL.LastIndexOf('/'));
                                if (ReturnUrl.EndsWith("/"))
                                {
                                    ReturnUrl += sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                                }
                                else
                                {
                                    ReturnUrl += '/' + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                                }
                            }
                        }
                        else
                        {
                            ReturnUrl = Request.QueryString["ReturnUrl"].ToString();
                        }
                        if (GetPortalID > 1)
                        {
                            RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx?ReturnUrl=" + ReturnUrl;
                        }
                        else
                        {
                            RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx?ReturnUrl=" + ReturnUrl;
                        }
                    }
                    else
                    {
                        string[] arrUrl;
                        string   strURL = string.Empty;
                        arrUrl = Request.RawUrl.Split('?');
                        string[] keys = Request.QueryString.AllKeys;
                        for (int i = 0; i < Request.QueryString.Count; i++)
                        {
                            string[] values = Request.QueryString.GetValues(i);
                            if (values != null)
                            {
                                strURL += keys[i] + '=' + values[0] + '&';
                            }
                        }
                        if (strURL.Length > 0)
                        {
                            strURL = strURL.Remove(strURL.LastIndexOf('&'));
                        }
                        ReturnUrl = arrUrl[0] + Server.UrlEncode(strURL.Length > 0 ? "?" + strURL : "");
                        //Response.Redirect("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pb.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + "&ReturnUrl=" + (Request.QueryString["pgnm"] == null ? pb.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) : Request.QueryString["pgnm"].ToString()));
                        RedUrl = "~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + "&ReturnUrl=" + ReturnUrl;
                    }
                }
                else
                {
                    //TODO:: Clear the session HERE
                    RegenerateSessionID();
                    FormsAuthentication.SignOut();
                    lnkloginStatus.Text = "Login";
                    SetUserRoles(string.Empty);
                    if (IsUseFriendlyUrls)
                    {
                        if (GetPortalID > 1)
                        {
                            RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                        }
                        else
                        {
                            RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                        }
                    }
                    else
                    {
                        RedUrl = "~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);
                    }
                }
                Response.Redirect(RedUrl, false);
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
    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);
        }
    }
Exemplo n.º 10
0
        protected void lnkloginStatus_Click(object sender, EventArgs e)
        {
            try
            {
                ///Update the Session Tracker
                SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
                sLog.SessionLogEnd(sessionTracker);

                SessionTracker sessionTrackerNew = new SessionTracker();
                if (sessionTrackerNew != null)
                {
                    SageFrame.Web.SessionLog sLogNew = new SageFrame.Web.SessionLog();
                    sLogNew.SessionLogStart(sessionTrackerNew);
                }
                HttpContext.Current.Session["Tracker"] = sessionTrackerNew;


                string ReturnUrl = string.Empty;
                string RedUrl = string.Empty;
                SageFrameConfig sfConfig = new SageFrameConfig();
                if (lnkloginStatus.CommandName == "LOGIN")
                {
                    if (IsUseFriendlyUrls)
                    {
                        if (Request.QueryString["ReturnUrl"] == null)
                        {
                            ReturnUrl = Request.RawUrl.ToString();
                            if (!(ReturnUrl.ToLower().Contains(".aspx")))
                            {
                                //ReturnUrl = ReturnUrl.Remove(strURL.LastIndexOf('/'));
                                if (ReturnUrl.EndsWith("/"))
                                {
                                    ReturnUrl += sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                                }
                                else
                                {
                                    ReturnUrl += '/' + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                                }
                            }
                        }
                        else
                        {
                            ReturnUrl = Request.QueryString["ReturnUrl"].ToString();
                        }
                        if (GetPortalID > 1)
                        {
                            RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx?ReturnUrl=" + ReturnUrl;

                        }
                        else
                        {
                            RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + ".aspx?ReturnUrl=" + ReturnUrl;
                        }
                    }
                    else
                    {
                        string[] arrUrl;
                        string strURL = string.Empty;
                        arrUrl = Request.RawUrl.Split('?');
                        string[] keys = Request.QueryString.AllKeys;
                        for (int i = 0; i < Request.QueryString.Count; i++)
                        {
                            string[] values = Request.QueryString.GetValues(i);
                            if (values != null) strURL += keys[i] + '=' + values[0] + '&';
                        }
                        if (strURL.Length > 0)
                        {
                            strURL = strURL.Remove(strURL.LastIndexOf('&'));
                        }
                        ReturnUrl = arrUrl[0] + Server.UrlEncode(strURL.Length > 0 ? "?" + strURL : "");
                        //Response.Redirect("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pb.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + "&ReturnUrl=" + (Request.QueryString["pgnm"] == null ? pb.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) : Request.QueryString["pgnm"].ToString()));
                        RedUrl = "~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + "&ReturnUrl=" + ReturnUrl;
                    }
                }
                else
                {
                    //TODO:: Clear the session HERE
                    RegenerateSessionID();
                    FormsAuthentication.SignOut();
                    lnkloginStatus.Text = "Login";
                    SetUserRoles(string.Empty);                    
                    if (IsUseFriendlyUrls)
                    {
                        if (GetPortalID > 1)
                        {
                            RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                        }
                        else
                        {
                            RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx";
                        }
                    }
                    else
                    {
                        RedUrl = "~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage);                        
                    }
                }
                Response.Redirect(RedUrl, false);
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
    protected void lnkloginStatus_Click(object sender, EventArgs e)
    {
        try
        {
            ///Update the Session Tracker
            SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
            if (sessionTracker != null)
            {
                SageFrame.Web.SessionLog sLog = new SageFrame.Web.SessionLog();
                sLog.SessionLogEnd(sessionTracker);
            }
            SessionTracker sessionTrackerNew = new SessionTracker();
            if (sessionTrackerNew != null)
            {
                SageFrame.Web.SessionLog sLogNew = new SageFrame.Web.SessionLog();
                sLogNew.SessionLogStart(sessionTrackerNew);
            }
            HttpContext.Current.Session[SessionKeys.Tracker] = sessionTrackerNew;
            string ReturnUrl = string.Empty;
            string RedUrl = string.Empty;
            SageFrameConfig sfConfig = new SageFrameConfig();
            if (lnkloginStatus.CommandName == "LOGIN")
            {
                if (IsUseFriendlyUrls)
                {
                    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 (GetPortalID > 1)
                    {
                        RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;

                    }
                    else
                    {
                        RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + SageFrameSettingKeys.PageExtension;
                    }
                }
                else
                {
                    string[] arrUrl;
                    string strURL = string.Empty;
                    arrUrl = Request.RawUrl.Split('?');
                    string[] keys = Request.QueryString.AllKeys;
                    for (int i = 0; i < Request.QueryString.Count; i++)
                    {
                        string[] values = Request.QueryString.GetValues(i);
                        strURL += keys[i] + '=' + values[0] + '&';
                    }
                    if (strURL.Length > 0)
                    {
                        strURL = strURL.Remove(strURL.LastIndexOf('&'));
                    }
                    ReturnUrl = arrUrl[0] + Server.UrlEncode(strURL.Length > 0 ? "?" + strURL : "");
                    RedUrl = "~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalLoginpage) + "&ReturnUrl=" + ReturnUrl;
                }
            }
            else
            {
            //                FormsAuthentication.SignOut();                
                HttpCookie authenticateCookie = new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID);
                authenticateCookie.Expires = DateTime.Now.AddYears(-1);
                Response.Cookies.Add(authenticateCookie);
                lnkloginStatus.Text = "Login";
                SetUserRoles(string.Empty);
                if (IsUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        RedUrl = "~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                    }
                    else
                    {
                        RedUrl = "~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;
                    }
                }
                else
                {
                    RedUrl = "~/Default" + Extension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-");
                }
            }

            Response.Redirect(RedUrl, false);
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }