HTTP服务器软件系统的设计与实现(10)_毕业论文

毕业论文移动版

毕业论文 > 计算机论文 >

HTTP服务器软件系统的设计与实现(10)


            
            ApplicationSettings settings = sessionMgr.Info;
            string sessionKey = string.Empty;
            ///
            /// 现在我们检查,如果已经存在任何会话是SessionManager
            ///
            switch (settings.SessionType)
            {
                case ApplicationSessionMode.SingletonSession:
                    ///
                    /// SingletonSession
                    ///
                    application = sessionMgr.GetOrCreateSingletonInstance();
                    return true;
                case ApplicationSessionMode.BrowserSession:
                    ///
                    /// 我们需要一个会话密钥identfy particolare浏览器
                    ///                    
                    sessionKey = e.Rawrequest.Connection.IP + "@" + e.Requests["User-Agent"];
                    break;
                case ApplicationSessionMode.IpSession:
                    ///
                    /// 我们需要一个会话密钥,identfy一个IP地址
                    ///                    
                    sessionKey = e.Rawrequest.Connection.IP.ToString();
                    break;
            }
           
            application = sessionMgr.GetOrCreateInstanceBySessionKey(sessionKey);

            return true;
        } (责任编辑:qin)