问题
I have a .net core 2.2 web application where the Signin happens using the following code
await _httpContextAccessor.HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
The values of httpContextAccessor.httpContext.user.identity.name are retained properly for further requests and works in VS2017.
But on deploying to server with IIS the same code doesnt work and the values for httpContextAccessor.User.Identity.Name is returning empty.
Any idea what the problem is?
Thanks
回答1:
You can open IIS and: 1-Activate Windows Autentication; 2-Disable Anonymous Autentication.
Place on IIS where is autentication configuration
Configurations
来源:https://stackoverflow.com/questions/59737989/httpcontextaccessor-httpcontext-user-identity-name-is-empty-in-iis-working-in-v