예제 #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,
                              RoleManager <IdentityRole> roleManager,
                              UserManager <IdentityUser> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/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.UseAuthentication();

            ApplicationDbInitializer.Seed(roleManager, userManager);

            app.UseMvc();
        }
예제 #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();
            }
            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?}");
            });

            // TODO seed the database
            ApplicationDbInitializer.Seed(app);
        }
예제 #3
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, RoleManager <IdentityRole> roleManager, UserManager <User> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseSession();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            ApplicationDbInitializer.Seed(roleManager, userManager).Wait();
        }
예제 #4
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ApplicationDbInitializer dbInitializer)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
                app.UseDatabaseErrorPage();
                app.UseStaticFiles();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            dbInitializer.Seed();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
예제 #5
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider, ApplicationDbInitializer dbInitializer)
        {
            app.UseExceptionHandler(e => this.CaptureException(e));

            app.UseStaticFiles();

            app.UseAuthentication();

            dbInitializer.Seed();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
예제 #6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ApplicationDbInitializer dbInitializer,
                              ApplicationIdentityInitializer identityInitializer)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseAuthentication();
            app.UseHttpsRedirection();
            app.UseMvc();

            dbInitializer.Seed().Wait();
            identityInitializer.Seed().Wait();
        }
예제 #7
0
        public void Configure(
            IApplicationBuilder app,
            IConfiguration configuration,
            IHostingEnvironment hostingEnvironment,
            ILoggerFactory loggerFactory,
            IDataProviderFactory dataProviderFactory,
            IUnitOfWork unitOfWork)
        {
            loggerFactory.AddConsole(configuration.GetSection("Logging"));

            if (hostingEnvironment.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            ApplicationDbInitializer.Seed(unitOfWork, dataProviderFactory).Wait();

            app.ConfigureSwagger();
            app.UseStatusCodePages();
            app.UseMvc();
        }
예제 #8
0
        // Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ApplicationDbInitializer dbInitializer)
        {
            // specify how to handle exceptions
            if (env.IsDevelopment())
            {
                // display rich error info pages when in development mode
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
                app.UseDatabaseErrorPage();
            }
            else
            {
                // custom handler - display error page
                app.UseExceptionHandler("/JobOffer/Error");
            }

            app.UseStaticFiles();

            app.UseRequestLocalization();

            // enable authentication
            app.UseAuthentication();

            // create + seed database with default values
            dbInitializer.Seed();

            // re-execute invalid requests (i.e when user tries to access a page that does not exist)
            app.UseStatusCodePagesWithReExecute("/JobOffer/Error", "?statusCode={0}");

            // configure mvc routing
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    // specify route template with default values
                    template: "{controller=JobOffer}/{action=Popular}/{id?}");
            });
        }