コード例 #1
0
        /// <summary>
        /// Creates a new instance of <see cref="DatabaseSessionStorageProviderBase" /> class with the specified settings.
        /// </summary>
        /// <param name="settings">The <see cref="SessionStorageProviderElement" /> object that holds the configuration settings.</param>
        public DatabaseSessionStorageProviderBase(SessionStorageProviderElement settings)
            : base(settings)
        {
            string connectionStringName = settings.Parameters["connectionStringName"];

            if (!string.IsNullOrEmpty(connectionStringName))
                // TODO: also get type
                _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
            else
                _connectionString = settings.Parameters["connectionString"];

            if (string.IsNullOrEmpty(_connectionString))
                throw new Exception("sessionStorageProvider connectionString or connectionStringName attribute must be specified.");

            _table = settings.Parameters["table"];
            _sessionIdField = settings.Parameters["sessionIdField"];
            _requestIdField = settings.Parameters["requestIdField"];
            _statusField = settings.Parameters["statusField"];
            _lastUpdatedField = settings.Parameters["lastUpdatedField"];

            if (string.IsNullOrEmpty(_table))
                throw new Exception("sessionStorageProvider table attribute must be specified.");
            if (string.IsNullOrEmpty(_sessionIdField))
                throw new Exception("sessionStorageProvider sessionIdField attribute must be specified.");
            if (string.IsNullOrEmpty(_requestIdField))
                throw new Exception("sessionStorageProvider requestIdField attribute must be specified.");
            if (string.IsNullOrEmpty(_statusField))
                throw new Exception("sessionStorageProvider statusField attribute must be specified.");
            if (string.IsNullOrEmpty(_lastUpdatedField))
                throw new Exception("sessionStorageProvider lastUpdatedField attribute must be specified.");

        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="SessionStateSessionStorageProvider" /> class with the specified settings.
        /// </summary>
        /// <param name="settings">The <see cref="SessionStorageProviderElement" /> object that holds the configuration settings.</param>
        public SessionStateSessionStorageProvider(SessionStorageProviderElement settings)
            : base(settings)
        {
            _handlerUrl = settings.Parameters["handlerUrl"];

            if (string.IsNullOrEmpty(_handlerUrl))
                _handlerUrl = "~/SlickUpload.axd";
        }
コード例 #3
0
        /// <summary>
        /// Creates a new instance of the <see cref="AdaptiveSessionStorageProvider" /> class with the specified settings.
        /// </summary>
        /// <param name="settings">The <see cref="SessionStorageProviderElement" /> object that holds the configuration settings.</param>
        public AdaptiveSessionStorageProvider(SessionStorageProviderElement settings)
            : base(settings)
        {
            // TODO: error handle?
            SessionStateSection section = (SessionStateSection)ConfigurationManager.GetSection("system.web/sessionState");

            if (section.Mode == SessionStateMode.Off || section.Mode == SessionStateMode.InProc)
                _provider = new InProcSessionStorageProvider(settings);
            else
                _provider = new SessionStateSessionStorageProvider(settings);
        }
コード例 #4
0
 /// <summary>
 /// Creates a new instance of the <see cref="SqlClientSessionStorageProvider" /> class with the specified settings.
 /// </summary>
 /// <param name="settings">The <see cref="SessionStorageProviderElement" /> object that holds the configuration settings.</param>
 public SqlClientSessionStorageProvider(SessionStorageProviderElement settings) :
     base(settings)
 { }
コード例 #5
0
 /// <summary>
 /// Creates a new instance of the <see cref="SessionStorageProviderBase" /> class with the specified settings.
 /// </summary>
 /// <param name="settings">The <see cref="SessionStorageProviderElement" /> object that holds the configuration settings.</param>
 protected SessionStorageProviderBase(SessionStorageProviderElement settings)
 {
     _settings = settings;
 }