internal SessionOnEndTargetWorkItem(SessionOnEndTarget target, HttpSessionState sessionState) { _target = target; _sessionState = sessionState; }
/*public*/ void IStateClientManager.ConfigInit(SessionStateSectionHandler.Config config, SessionOnEndTarget onEndTarget) { s_callback = new CacheItemRemovedCallback(onEndTarget.OnCacheItemRemoved); }
internal SessionOnEndTargetWorkItem(SessionOnEndTarget target, HttpSessionState sessionState) { this._target = target; this._sessionState = sessionState; }
/*public*/ void IStateClientManager.ConfigInit(SessionStateSectionHandler.Config config, SessionOnEndTarget onEndTarget) { /* * Parse the connection string for errors. We want to ensure * that the user's connection string doesn't contain an * Initial Catalog entry, so we must first create a dummy connection. */ SqlConnection dummyConnection; try { dummyConnection = new SqlConnection(config._sqlConnectionString); } catch (Exception e) { throw new ConfigurationException(e.Message, e, config._configFileName, config._sqlLine); } string database = dummyConnection.Database; if (database != null && database.Length > 0) { throw new ConfigurationException( HttpRuntime.FormatResourceString(SR.No_database_allowed_in_sqlConnectionString), config._configFileName, config._sqlLine); } s_useIntegratedSecurity = DetectIntegratedSecurity(config._sqlConnectionString); s_sqlConnectionString = config._sqlConnectionString + ";Initial Catalog=ASPState"; s_rpool = new ResourcePool(new TimeSpan(0, 0, 5), int.MaxValue); }
/*public*/ void IStateClientManager.ConfigInit(SessionStateSectionHandler.Config config, SessionOnEndTarget onEndTarget) { int hr; try { /* * stateConnection string has the following format: * * "tcpip=<server>:<port>" */ string [] parts = config._stateConnectionString.Split(new char[] { '=' }); if (parts.Length != 2 || parts[0] != "tcpip") { throw new ArgumentException(); } parts = parts[1].Split(new char[] { ':' }); if (parts.Length != 2) { throw new ArgumentException(); } s_server = parts[0]; s_port = (int)System.UInt16.Parse(parts[1]); s_networkTimeout = config._stateNetworkTimeout; // At v1, we won't accept server name that has non-ascii characters foreach (char c in s_server) { if (c > 0x7F) { throw new ArgumentException(); } } } catch { throw new ConfigurationException( HttpRuntime.FormatResourceString(SR.Invalid_value_for_sessionstate_stateConnectionString, config._stateConnectionString), config._configFileName, config._stateLine); } string appId = HttpRuntime.AppDomainAppIdInternal; string idHash = MachineKey.HashAndBase64EncodeString(appId); s_uribase = "/" + appId + "(" + idHash + ")/"; s_rpool = new ResourcePool(new TimeSpan(0, 0, 5), int.MaxValue); hr = UnsafeNativeMethods.SessionNDConnectToService(s_server); if (hr != 0) { throw new HttpException(HttpRuntime.FormatResourceString(SR.Cant_connect_to_session_service), hr); } }