Hello Developers, I am new to ASP.Net core 2.0.1, i studied the architecture of Authentication and identification in core framework,i facing some problems during migration, please help. In the Startup.cs file, I am using this piecce of code in ConfigureServices method
<div class="pre-action-link" id="premain926311">Hide Copy Code</div>app.use(async (context, next) => { // When the user is already authenticated, check if the session is still alive, if not, log him out. //do something await context.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); await context.Authentication.ChallengeAsync(CookieAuthenticationDefaults.AuthenticationScheme); //OR await next.Invoke(); }
Now in core, i dont know how to handle these 2 functions for logout
I get NULLREFERENCE Exception
var projectId = context?.Session?.GetInt("Project_Id");
when page is refershed after a while.
Please help me to resolve these issue.