// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, SeedingService seedingService) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); seedingService.seed(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, SeedingService seedingService) { var enUS = new CultureInfo("en-US"); var localizationOptions = new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture(enUS), SupportedCultures = new List <CultureInfo> { enUS }, SupportedUICultures = new List <CultureInfo> { enUS } }; app.UseRequestLocalization(localizationOptions); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); seedingService.seed(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }
// Este método é chamado em tempo de execução para configurar o pipeline de solicitação HTTP. public void Configure(IApplicationBuilder app, IHostingEnvironment env, SeedingService seedingService) //Aplica ao depurar o código { // Middlewares do Software // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. if (env.IsDevelopment()) //Habilita mensagem de error ambiente de desenvolvimento { app.UseDeveloperExceptionPage(); seedingService.seed(); //Popula a base de dados com os dados padrões } else { // app.UseExceptionHandler("/Home/Error"); app.UseStatusCodePagesWithRedirects("/Error/{0}"); //Redireciona para qualquer página de erro que use HTTP (lado Cliente) app.UseExceptionHandler("/Error/Error500"); //Redireciona para página de erro do lado do servidor app.UseHsts(); } app.UseHttpsRedirection(); app.UseDefaultFiles(); app.UseStaticFiles(); app.UseSession(); //Métodos usado para fazer funcionar a Sessão (Incluir) app.UseMiddleware <ValidateAntiForgeryTokenMiddleware>(); //AntiForgeryToken - Evitar ataques maliciosos CSRF por método Post (Valido para toda a aplicação) app.UseCookiePolicy(); app.UseMvc(routes => { //Rota adicionada para Area do Colaborador e Cliente (Tem a prioridade de chamada) routes.MapRoute( name: "areas", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}" ); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, SeedingService seedingService) { var enUS = new CultureInfo("en-US"); var localizationOptions = new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture(enUS), SupportedCultures = new List <CultureInfo> { enUS }, SupportedUICultures = new List <CultureInfo> { enUS } }; app.UseRequestLocalization(localizationOptions); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); seedingService.seed(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, SeedingService seedingService2) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); seedingService2.seed(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }