This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AutofacConfig | |
{ | |
public static void Configure() | |
{ | |
var builder = new ContainerBuilder(); | |
builder.RegisterType<ApplicationDbContext>().AsSelf().InstancePerLifetimeScope(); | |
builder.RegisterType<ApplicationUserStore>().As<IUserStore<PortalUser>>().InstancePerLifetimeScope(); | |
builder.RegisterType<ApplicationUserManager>().AsSelf().InstancePerLifetimeScope(); | |
builder.RegisterType<ApplicationSignInManager>().AsSelf().InstancePerLifetimeScope(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddCsrfTokenHeader:ActionFilterAttribute | |
{ | |
public override void OnResultExecuted(ResultExecutedContext filterContext) | |
{ | |
HttpCookie cookie = null; | |
// First, try and get cookie from Response. That'll be a new cookie | |
if (filterContext.HttpContext.Response.Cookies.AllKeys.Contains(AntiForgeryConfig.CookieName)) | |
{ | |
cookie = filterContext.HttpContext.Response.Cookies.Get(AntiForgeryConfig.CookieName); |