// 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"); } SeederDb.SeedData(app.ApplicationServices, env, this.Configuration); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "gentefilter", template: "Treks/{action}/{genre?}", defaults: new { action = "ListTreks" }); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseAuthentication(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseSession(); app.UseStaticFiles(); //app.UseCookiePolicy(); SeederDb.SeedData(app.ApplicationServices, env, this.Configuration); 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) { // it was added by myself app.UseCors(builder => { builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // 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.UseAuthentication(); app.UseMvc(); // it was added by myself SeederDb.SeedData(app.ApplicationServices); // it was added by myself }
public MainForm() { InitializeComponent(); eFContext = new EFContext(); SeederDb.Seed(eFContext); questions = eFContext.Questions.Include(x => x.Answers).ToList(); results = new Answer[questions.Count]; loadQuestion(); }
// 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.UseHsts(); } app.UseMvc(); app.UseHttpsRedirection(); // дозвіл на авторизацію app.UseAuthentication(); // дозвіл серверу на роботу з файлами app.UseStaticFiles(); //////////////////////////////////////////////////////////////////// //////////// Прописуємо настройки роботи з фото string dirPathSave = ImageHelper.GetImageFolder(env, this.Configuration); // вказуємо серверу як називатиметься папка з фото string imageUrl = "/images"; app.UseStaticFiles(new StaticFileOptions() { // вказуємо папку FileProvider = new PhysicalFileProvider(dirPathSave), // вказуємо url RequestPath = new PathString(imageUrl) }); SeederDb.SeedData(app.ApplicationServices, env, this.Configuration); }