コード例 #1
0
        internal ServerConfig()
        {
            DefaultDocuments          = new List <string>();
            LogExtensions             = new List <string>();
            LocalIP                   = IPAddress.Any;
            Authentication            = new AuthenticationConfiguration();
            Caching                   = new CachingConfig();
            Cookies                   = new CookiesConfiguration();
            Session                   = new SessionConfiguration();
            Security                  = new SecurityConfig();
            this.VirtualPathProviders = new VirtualPathProviders();
            this.HttpHandlers         = new List <HttpHandler>();
            this.AssembliesToLoad     = new List <string>();
            m_loadedAssemblies        = new List <Assembly>();

            HostLocation = Path.GetDirectoryName(new Uri(Assembly.GetCallingAssembly().GetName().CodeBase).LocalPath);

            SetDefaults();

            ServerVersion = Assembly.GetExecutingAssembly().GetName().Version;
        }
コード例 #2
0
        internal static SessionConfiguration FromXml(XmlNode sessionNode)
        {
            SessionConfiguration config = new SessionConfiguration();

            var attrib = sessionNode.Attributes["allowSessionState"];

            if (attrib == null)
            {
                config.AllowSessionState = DefaultAllowSessionState;
            }
            else
            {
                try
                {
                    config.AllowSessionState = bool.Parse(attrib.Value);
                }
                catch
                {
                    config.AllowSessionState = DefaultAllowSessionState;
                }
            }

            attrib = sessionNode.Attributes["max"];
            if (attrib == null)
            {
                config.MaxSessions = DefaultMaxSessions;
            }
            else
            {
                try
                {
                    config.MaxSessions = int.Parse(attrib.Value);
                }
                catch
                {
                    config.MaxSessions = DefaultMaxSessions;
                }
            }

            attrib = sessionNode.Attributes["timeout"];
            if (attrib == null)
            {
                config.Timeout = DefaultTimeout;
            }
            else
            {
                try
                {
                    config.Timeout = (int)TimeSpan.Parse(attrib.Value).TotalMinutes;
                }
                catch
                {
                    config.Timeout = DefaultTimeout;
                }
            }

            if (config.Timeout < 1)
            {
                config.Timeout = DefaultTimeout;
            }

            return(config);
        }