Skip to content
Loading
  • Viswanatha Swamy
    0
    When we are seeing the userManager is null. I am assuming that it is not able to load it using dependency injection. Could you please verify your Start Up class 
     
    1. public partial class Startup  
    2.   
    3.     {  
    4.   
    5.         // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864  
    6.   
    7.         public void ConfigureAuth(IAppBuilder app)  
    8.   
    9.         {  
    10.   
    11.             // Configure the db context, user manager and signin manager to use a single instance per request  
    12.   
    13.             app.CreatePerOwinContext(ApplicationDbContext.Create);  
    14.   
    15.             app.CreatePerOwinContext(ApplicationUserManager.Create);  
    16.   
    17.             app.CreatePerOwinContext(ApplicationSignInManager.Create);  
    18.       }
    19. }  
     
    0
  • 0
    Hi VIswanatha
     
    I did and called it Startup.Auth.cs file under App_Start folder and its calling the relevant namespace.
    1. using System;  
    2. using Microsoft.AspNet.Identity;  
    3. using Microsoft.AspNet.Identity.Owin;  
    4. using Microsoft.Owin;  
    5. using Microsoft.Owin.Security.Cookies;  
    6. using Microsoft.Owin.Security.Google;  
    7. using Owin;  
    8. using eNtsaTrainingRegistration.Models;  
    9.   
    10. namespace eNtsaTrainingRegistration  
    11. {  
    12.     public partial class Startup  
    13.     {  
    14.         public void ConfigureAuth(IAppBuilder app)  
    15.         {  
    16.             app.CreatePerOwinContext(ApplicationDbContext.Create);  
    17.             app.CreatePerOwinContext(ApplicationSignInManager.Create);  
    18.             app.CreatePerOwinContext(ApplicationUserManager.Create);  
    19.             app.CreatePerOwinContext(ApplicationRoleManager.Create);  
    20.   
    21.   
    22.   
    23.             app.UseCookieAuthentication(new CookieAuthenticationOptions  
    24.             {  
    25.                 AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,  
    26.                 LoginPath = new PathString("/login"),  
    27.                 Provider = new CookieAuthenticationProvider  
    28.                 {  
    29.                     OnValidateIdentity = SecurityStampValidator.OnValidateIdentity(  
    30.                         validateInterval:TimeSpan.FromMinutes(30),  
    31.                         regenerateIdentity:(manager, user) => user.GenerateUserIdentityAsync(manager))  
    32.                 }  
    33.             });  
    34.               
    35.             app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);  
    36.   
    37.             app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));  
    38.   
    39.             app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);  
    40.         }  
    41.     }  
    42. }  
     
    0
  • Viswanatha Swamy
    0
    Hello,
    Could you please place a debugger inside the Application Sign In Manager and put the first parameter in to watch? Let's see whether it gives us an object OR null. Many thanks. 
     
     
    0
  • 0
    Hi Swamy
     
    After debugging i found out the following error and when adding it to watch.
     
     
    0
  • Viswanatha Swamy
    0
    Is there a way you can do screen share? we can hunt the issue down.
    0
  • 0
    Hi Swamy will inbox you IP address for my AnyDesk
    0