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;
} HTTP服务器软件系统的设计与实现(10):http://www.751com.cn/jisuanji/lunwen_3170.html