Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <AppUser> userManager
                              , RoleManager <AppRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }


            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseStaticFiles();
            IdentityInitializer.SeedData(userManager, roleManager).Wait();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "areas",
                    pattern: "{area}/{controller=Home}/{action=Index}/{id?}"
                    );

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}"
                    );
            });
        }
Exemplo n.º 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
            });
        }