Example #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)
        {
            var ptBR         = new CultureInfo("pt-BR");
            var localOptions = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture(ptBR),
                SupportedCultures     = new List <CultureInfo> {
                    ptBR
                },                                                              // lista de idiomas suportados
                SupportedUICultures = new List <CultureInfo> {
                    ptBR
                }
            };

            using (var scope = app.ApplicationServices.GetRequiredService <IServiceProvider>().CreateScope())
            {
                var context = scope.ServiceProvider.GetRequiredService <Context>();
                context.Database.EnsureCreated();
            }

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

            RotativaHqConfiguration.SetRotativaHqApiKey("24739c913e4f43728b9e4a7605c087af");
            RotativaHqConfiguration.SetRotativaHqUrl("https://useast.rotativahq.com");

            app.UseRequestLocalization(localOptions);
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSession();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Users}/{action=Login}/{id?}");
            });
        }
Example #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

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

            RotativaHqConfiguration.SetRotativaHqUrl("https://eunorth.rotativahq.com");
            RotativaHqConfiguration.SetRotativaHqApiKey("");
        }