I have checked all the details inside Web.config file and it is properly configured as well.
public async Task SignIn()
{
if (!Request.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties { RedirectUri = "/" },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
}
Also try some solution found in similar problem but it didn't work for me.
Request.IsAuthenticated is always false
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
</modules>
</system.webServer>
I am following code sample by Azure https://learn.microsoft.com/en-us/azure/active-directory/develop/sample-v2-code (Web Application - Asp.net)
https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect/tree/master/WebApp