示例#1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <AppUser> userManager, RoleManager <AppRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseStatusCodePagesWithReExecute("/Home/StatusCode", "?code={0}");
            IdentityInitializer.SeedDate(userManager, roleManager).Wait();
            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseStaticFiles();//wwwroot

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "areas",
                    pattern: "{area}/{controller=Home}/{action=Index}/{id?}"

                    );


                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}"
                    );
            });
        }
示例#2
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <AppUser> userManager, RoleManager <AppRole> roleManager)
        {
            //yazýlým surecýndeyse
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStatusCodePagesWithReExecute("/Home/StatusCode", "?code={0}");//sayfa bulunamadý hatasý yapar
            app.UseRouting();
            //Giriþ yonetimi
            app.UseAuthentication();
            //rolbazlýyetkilendirmede yapacagýmdan
            app.UseAuthorization();
            IdentityInitializer.SeedData(userManager, roleManager).Wait(); //bu sekilde kod calýsýrken bu configurelere gore calýssýn dýyorum
            app.UseStaticFiles();                                          //wwwroot dýsarýya acýyorum

            app.UseEndpoints(endpoints =>
            {
                //arealar icin
                endpoints.MapControllerRoute(
                    name: "areas",
                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"//eger area versa exist demek

                    );
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}"
                    );
                //  endpoints.MapDefaultControllerRoute();//default olarak yap diyorum
            });
        }