public void Init (SessionStateModule module, HttpApplication context, SessionConfig config) { string connectionTypeName; string providerAssemblyName; string cncString; this.config = config; GetConnectionData (out providerAssemblyName, out connectionTypeName, out cncString); if (cncType == null) { Assembly dbAssembly = Assembly.Load (providerAssemblyName); cncType = dbAssembly.GetType (connectionTypeName, true); if (!typeof (IDbConnection).IsAssignableFrom (cncType)) throw new ApplicationException ("The type '" + cncType + "' does not implement IDB Connection.\n" + "Check 'DbConnectionType' in server.exe.config."); } cnc = (IDbConnection) Activator.CreateInstance (cncType); cnc.ConnectionString = cncString; try { cnc.Open (); } catch (Exception exc) { cnc = null; throw exc; } }
public void Init(HttpApplication app) { sessionForStaticFiles = (Environment.GetEnvironmentVariable("MONO_XSP_STATIC_SESSION") != null); SessionConfig cfg = GetConfig(); if (handlerType == null) { return; } if (cfg.CookieLess) { app.BeginRequest += new EventHandler(OnBeginRequest); } app.AcquireRequestState += new EventHandler(OnAcquireState); app.ReleaseRequestState += new EventHandler(OnReleaseRequestState); app.EndRequest += new EventHandler(OnEndRequest); if (handlerType != null && handler == null) { handler = (ISessionHandler)Activator.CreateInstance(handlerType); handler.Init(this, app, cfg); //initialize } }
public void Init (SessionStateModule module, HttpApplication context, SessionConfig config) { this.config = config; RemotingConfiguration.Configure (null); string cons, proto, server, port; GetConData (config.StateConnectionString, out proto, out server, out port); cons = String.Format ("{0}://{1}:{2}/StateServer", proto, server, port); state_server = (RemoteStateServer) Activator.GetObject (typeof (RemoteStateServer), cons); }
internal void OnSessionRemoved(string key, object value, CacheItemRemovedReason reason) { SessionConfig cfg = GetConfig(); // Only invoked for InProc (see msdn2 docs on SessionStateModule.End) if (cfg.Mode == SessionStateMode.InProc) { HttpApplicationFactory.InvokeSessionEnd(value); } }
public object Create (object parent, object context, XmlNode section) { //TODO: context? SessionConfig config = new SessionConfig (parent); if (section.HasChildNodes) ThrowException ("No children nodes allowed", section); string attvalue = AttValue ("mode", section, false); if (!config.SetMode (attvalue)) ThrowException ("Invalid mode value", section); if (section.Attributes == null) return config; attvalue = AttValue ("cookieless", section); if (attvalue != null) if (!config.SetCookieLess (attvalue)) ThrowException ("Invalid cookieless value", section); attvalue = AttValue ("timeout", section); if (attvalue != null) if (!config.SetTimeout (attvalue)) ThrowException ("Invalid timeout value", section); attvalue = AttValue ("stateConnectionString", section); if (attvalue != null) config.SetStateConnectionString (attvalue); attvalue = AttValue ("sqlConnectionString", section); if (attvalue != null) config.SetSqlConnectionString (attvalue); attvalue = AttValue ("stateNetworkTimeout", section); if (attvalue != null) config.SetStateNetworkTimeout (attvalue); if (section.Attributes != null && section.Attributes.Count > 0) HandlersUtil.ThrowException ("Unknown attribute.", section); return config; }
public void Init(SessionStateModule module, HttpApplication context, SessionConfig config) { this.config = config; this.AppPath = context.Request.ApplicationPath; try { InitializeConnection(); } catch (Exception exc) { cnc = null; throw exc; } if (paramPrefix != defaultParamPrefix) { ReplaceParamPrefix(ref selectCommandText); ReplaceParamPrefix(ref insertCommandText); ReplaceParamPrefix(ref updateCommandText); ReplaceParamPrefix(ref deleteCommandText); } }
public void Init (SessionStateModule module, HttpApplication context, SessionConfig config) { this.config = config; this.AppPath = context.Request.ApplicationPath; try { InitializeConnection (); } catch (Exception exc) { cnc = null; throw exc; } if (paramPrefix != defaultParamPrefix) { ReplaceParamPrefix (ref selectCommandText); ReplaceParamPrefix (ref insertCommandText); ReplaceParamPrefix (ref updateCommandText); ReplaceParamPrefix (ref deleteCommandText); } }
SessionConfig GetConfig() { lock (locker) { if (config != null) { return(config); } config = (SessionConfig)HttpContext.GetAppConfig("system.web/sessionState"); if (config == null) { config = new SessionConfig(null); } #if TARGET_J2EE if (config.Mode == SessionStateMode.SQLServer || config.Mode == SessionStateMode.StateServer) { throw new NotImplementedException("You must use web.xml to specify session state handling"); } #else if (config.Mode == SessionStateMode.StateServer) { handlerType = typeof(SessionStateServerHandler); } if (config.Mode == SessionStateMode.SQLServer) { handlerType = typeof(SessionSQLServerHandler); } #endif if (config.Mode == SessionStateMode.InProc) { handlerType = typeof(SessionInProcHandler); } return(config); } }
public void Init (HttpApplication app) { sessionForStaticFiles = (Environment.GetEnvironmentVariable ("MONO_XSP_STATIC_SESSION") != null); if (config == null) { config = (SessionConfig) HttpContext.GetAppConfig ("system.web/sessionState"); if (config == null) config = new SessionConfig (null); if (config.Mode == SessionStateMode.StateServer) handlerType = typeof (SessionStateServerHandler); if (config.Mode == SessionStateMode.SQLServer) handlerType = typeof (SessionSQLServerHandler); if (config.Mode == SessionStateMode.InProc) handlerType = typeof (SessionInProcHandler); if (config.Mode == SessionStateMode.Off) return; } if (config.CookieLess) app.BeginRequest += new EventHandler (OnBeginRequest); app.AddOnAcquireRequestStateAsync ( new BeginEventHandler (OnBeginAcquireState), new EndEventHandler (OnEndAcquireState)); app.ReleaseRequestState += new EventHandler (OnReleaseRequestState); app.EndRequest += new EventHandler (OnEndRequest); if (handlerType != null && handler == null) { handler = (ISessionHandler) Activator.CreateInstance (handlerType); handler.Init (this, app, config); //initialize } }
public object Create(object parent, object context, XmlNode section) { //TODO: context? SessionConfig config = new SessionConfig(parent); if (section.HasChildNodes) { ThrowException("No children nodes allowed", section); } string attvalue = AttValue("mode", section, false); if (!config.SetMode(attvalue)) { ThrowException("Invalid mode value", section); } if (section.Attributes == null) { return(config); } attvalue = AttValue("cookieless", section); if (attvalue != null) { if (!config.SetCookieLess(attvalue)) { ThrowException("Invalid cookieless value", section); } } attvalue = AttValue("timeout", section); if (attvalue != null) { if (!config.SetTimeout(attvalue)) { ThrowException("Invalid timeout value", section); } } attvalue = AttValue("stateConnectionString", section); if (attvalue != null) { config.SetStateConnectionString(attvalue); } attvalue = AttValue("sqlConnectionString", section); if (attvalue != null) { config.SetSqlConnectionString(attvalue); } attvalue = AttValue("stateNetworkTimeout", section); if (attvalue != null) { config.SetStateNetworkTimeout(attvalue); } if (section.Attributes != null && section.Attributes.Count > 0) { HandlersUtil.ThrowException("Unknown attribute.", section); } return(config); }
public void Init(SessionStateModule module, HttpApplication context, SessionConfig config) { removedCB = new CacheItemRemovedCallback(module.OnSessionRemoved); this.config = config; }
public void Init (SessionStateModule module, HttpApplication context, SessionConfig config) { removedCB = new CacheItemRemovedCallback (module.OnSessionRemoved); this.config = config; }