SessionCreate() public method

Used to create a custom Profiles Session instance. This instance is used to track and store user activity as a form of Profiles Network.
public SessionCreate ( Session &session ) : void
session Session ref of Framework.Session object that stores the state of a Profiles user session
return void
コード例 #1
0
ファイル: Session.cs プロジェクト: rmatam/ProfilesRNS_ORCID
        /// <summary>
        ///     Public method used to create an instance of the custom Profiles session object.
        /// </summary>
        public void SessionCreate()
        {
            string sessionid  = string.Empty;
            string ORNGViewer = null;

            if (HttpContext.Current.Request["ContainerSessionID"] != null)
            {
                // ORNG this means it is from shindigorng. Grab the associated session and user
                sessionid  = HttpContext.Current.Request["ContainerSessionID"];
                ORNGViewer = HttpContext.Current.Request["Viewer"];
            }
            else if (HttpContext.Current.Request.Headers["SessionID"] != null)
            {
                sessionid = HttpContext.Current.Request.Headers["SessionID"];
            }

            DataIO  dataio   = new DataIO();
            Session session  = new Session();
            string  hostname = System.Net.Dns.GetHostName();

            string ipaddress = string.Empty;

            try
            {
                ipaddress = System.Net.Dns.GetHostAddresses(hostname).GetValue(1).ToString();
            }
            catch (Exception ex)
            {
                Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
                ipaddress = "";
            }

            session.RequestIP = ipaddress;
            session.UserAgent = HttpContext.Current.Request.UserAgent;
            session.IsBot     = IsBot(session.UserAgent);

            if (sessionid == string.Empty)
            {
                dataio.SessionCreate(ref session);
            }
            else
            {
                session.SessionID = sessionid;
                if (ORNGViewer != null && ORNGViewer.LastIndexOf('/') > 0)
                {
                    session.UserID = Convert.ToInt32(ORNGViewer.Substring(ORNGViewer.LastIndexOf('/') + 1));
                }
            }

            //Store the object in the current session of the user.
            HttpContext.Current.Session["PROFILES_SESSION"] = session;
        }
コード例 #2
0
        /// <summary>
        ///     Public method used to create an instance of the custom Profiles session object.
        /// </summary>
        public void SessionCreate()
        {
            string sessionid = string.Empty;
            string ORNGViewer = null;

            if (HttpContext.Current.Request["ContainerSessionID"] != null)
            {
                // ORNG this means it is from shindigorng. Grab the associated session and user
                sessionid = HttpContext.Current.Request["ContainerSessionID"];
                ORNGViewer = HttpContext.Current.Request["Viewer"];
            }
            else if (HttpContext.Current.Request.Headers["SessionID"] != null)
                sessionid = HttpContext.Current.Request.Headers["SessionID"];

            DataIO dataio = new DataIO();
            Session session = new Session();
            string hostname = System.Net.Dns.GetHostName();

            string ipaddress = string.Empty;
            try
            {
                ipaddress = System.Net.Dns.GetHostAddresses(hostname).GetValue(1).ToString();
            }
            catch (Exception ex)
            {
                Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
                ipaddress = "";
            }

            session.RequestIP = ipaddress;
            session.UserAgent = HttpContext.Current.Request.UserAgent;
            session.IsBot = IsBot(session.UserAgent);

            if (sessionid == string.Empty)
                dataio.SessionCreate(ref session);
            else
            {
                session.SessionID = sessionid;
                if (ORNGViewer != null && ORNGViewer.LastIndexOf('/') > 0)
                {
                    session.UserID = Convert.ToInt32(ORNGViewer.Substring(ORNGViewer.LastIndexOf('/') + 1));
                }
            }

            //Store the object in the current session of the user.
            HttpContext.Current.Session["PROFILES_SESSION"] = session;
        }
コード例 #3
0
        /// <summary>
        ///     Public method used to create an instance of the custom Profiles session object.
        /// </summary>
        public void SessionCreate()
        {
            string sessionid = HttpContext.Current.Request.Headers["SessionID"];

            DataIO dataio = new DataIO();
            Session session = new Session();
            string hostname = System.Net.Dns.GetHostName();

            string ipaddress = string.Empty;
            try
            {
                ipaddress = System.Net.Dns.GetHostAddresses(hostname).GetValue(1).ToString();
            }
            catch (Exception ex)
            {
                Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
                ipaddress = "";
            }

            session.RequestIP = ipaddress;
            session.UserAgent = HttpContext.Current.Request.UserAgent;

            if (sessionid == null)
                dataio.SessionCreate(ref session);
            else
            {
                session.SessionID = sessionid;
            }

            //Store the object in the current session of the user.
            HttpContext.Current.Session["PROFILES_SESSION"] = session;
        }