Example #1
0
 public TintucsController(WebTTContext context, IHostingEnvironment enviroment, HtmlEncoder htmlEncoder,
                          JavaScriptEncoder javascriptEncoder,
                          UrlEncoder urlEncoder)
 {
     _htmlEncoder       = htmlEncoder;
     _javaScriptEncoder = javascriptEncoder;
     _urlEncoder        = urlEncoder;
     _enviroment        = enviroment;
     _context           = context;
 }
Example #2
0
 public TinnhanhsController(WebTTContext context)
 {
     _context = context;    
 }
Example #3
0
 public ChuyenmucsController(WebTTContext context)
 {
     _context = context;
 }
Example #4
0
 public HomeController(WebTTContext context)
 {
     _context = context;
 }
Example #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, WebTTContext context)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
                //app.UseCookieAuthentication(new CookieAuthenticationOptions{

                //    LoginPath= "/Home/Login",

                //    LogoutPath="/Home/Index"
                //});
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseSession();
            //app.UseIdentity();
            app.UseCookieAuthentication(new CookieAuthenticationOptions()
            {
                AuthenticationScheme  = "MyCookieMiddlewareInstance",
                LoginPath             = new PathString("/Home/Login/"),
                AccessDeniedPath      = new PathString("/Home/Login/"),
                AutomaticAuthenticate = true,
                AutomaticChallenge    = true
            });

            // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
            //app.UseFacebookAuthentication(new FacebookOptions()
            //{
            //    AppId = "309375949484313",
            //    AppSecret ="f9245956f0ad94646eac40496bbfeb0c"
            //});
            //new UserRoleSeed(app.ApplicationServices.GetService<RoleManager<IdentityRole>>()).Seed();
        }