We have two section to the website. A public and a logged in section.
We notice that SQL is hit every page request. This request is coming from the IdentityDbContext because CreatePerOwinContext has registered this handler during startup.
//Startup Auth (code snip-it) app.CreatePerOwinContext(ApplicationDbContext.Create); // Identity Model public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext(): base("DBConnectionString") { } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } }
How can we skip Identity when we are on pages that are non-SSL (http), but if they attempt to log in they will be redirected to the SSL/HTTPS and we can "activate" Identity to do the right thing.
It would be a nice way to improve performance too. Why hit SQL if we don't care about the identity for public/static pages?
Thoughts?
Thank you.