How to Get the ID of the logged in user in asp.net mvc web api apicontroller

by Steve French in ASP.net MVC, Web Api on February 28, 2022

After much googling, and evening Bing-ing revealed nothing I discovered that for some reason I had the line

config.SuppressDefaultHostAuthentication();

In my WebAPIConfig.cs file – I removed that and everything magically worked and I could use User.Identity.GetUserId();