Hi,
I am using ASP.Net Core and Entity Framework 6.0.
I am trying to get the windows user info, which will be checked against the application database for authorization access.
I am having problems with the following script:
BaseController.cs
public class BaseController: Controller
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (HttpContext.User == null || HttpContext.User.Identity.AuthenticationType != "Forms")
{
//return null;
}
var identity = HttpContext.User.Identity;
}
}
web.config
<configuration>
<system.web>
<authentication mode="Windows" />
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>
When I run the application,
HttpContext.User.Identity.AuthenticationType = "" and HttpContext.User.Identity = "". How can I get the current windows username?
Thanks,
tinac99