// 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(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseAuthentication(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); StudentInitiator.InitialStudents(app.ApplicationServices).Wait(); BookInitiator.BookInitial(app.ApplicationServices).Wait(); }
// 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.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseAuthentication(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=BookInfo}/{action=Index}"); }); //app.Use(async (content, next) => //{ // content.Response.Headers.Add("Content-Security-Policy", "default-src 'self'"); // await next.Invoke(); //}); app.UseMiddleware <CSPMiddleware>(); app.Map("/BookInfo", appBuilder => { appBuilder.UseMiddleware <CSPMiddleware>(); }); StudentInitiator.InitialStudents(app.ApplicationServices).Wait(); BookInitiator.BookInitial(app.ApplicationServices).Wait(); }