You can try
public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
{
string username = HttpContext.Current.User.Identity.Name;
}
Check for authenticated user first:
string userName = null;
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
userName = HttpContext.Current.User.Identity.Name;
}
Try to use
HttpContext.Current.User.Identity.Name
Hope it works for you