예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env
                              , ApplicationDbContext context, UserManager <ApplicationUser> userManager,
                              RoleManager <IdentityRole> roleManager)
        {
            var supportedCultures = new[]
            {
                new CultureInfo("en-US"),
                new CultureInfo("sv-SE")
            };

            var options = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("SV-SE"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures
            };

            options.RequestCultureProviders = new[]
            {
                new CookieRequestCultureProvider()
                {
                    Options = options
                }
            };

            app.UseRequestLocalization(options);

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}/{slug?}");
            });

            DbSeeder.Seeder(context, userManager, roleManager);
        }