public static void Configure()
        {
            var section = ConfigurationManager.GetSection("webServer") as ServerSection ?? new ServerSection();

            AuthenticationSchemes = section.AuthenticationSchemes;
            RequestConfiguration.DefaultFileNames = section.DefaultFileNames.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            RequestConfiguration.RestrictedDirs = section.RestrictedDirs.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            BufferSize = section.BufferSize;
            HackWCFBinding = section.HackWCFBinding;
            Sites = section.Sites;

            if (section.HttpHandlers.Count == 0)
            {
                HttpHandlers = new HttpHandlerElementCollection();
                HttpHandlers.Add("*", typeof(StaticFileHttpHandler));
                foreach (var ext in aspHttpExtensions)
                {
                    HttpHandlers.Add(ext, typeof(AspNetHttpHandler));
                }
            }
            else
            {
                HttpHandlers = section.HttpHandlers;
            }
        }
Exemplo n.º 2
0
        public static void Configure()
        {
            var section = ConfigurationManager.GetSection("webServer") as ServerSection ?? new ServerSection();

            AuthenticationSchemes = section.AuthenticationSchemes;
            RequestConfiguration.DefaultFileNames = section.DefaultFileNames.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            RequestConfiguration.RestrictedDirs   = section.RestrictedDirs.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            BufferSize     = section.BufferSize;
            HackWCFBinding = section.HackWCFBinding;
            Sites          = section.Sites;

            if (section.HttpHandlers.Count == 0)
            {
                HttpHandlers = new HttpHandlerElementCollection();
                HttpHandlers.Add("*", typeof(StaticFileHttpHandler));
                foreach (var ext in aspHttpExtensions)
                {
                    HttpHandlers.Add(ext, typeof(AspNetHttpHandler));
                }
            }
            else
            {
                HttpHandlers = section.HttpHandlers;
            }
        }