[Vuejs]-Current logged in user on IIS in Vue.js application

0👍

In my opinion, you could not get the windows user in vue js. if you want to get the windows user identity in .net core site you could use below code:

In ConfigureServices

services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();

In controller

private readonly IHttpContextAccessor _httpContextAccessor;

public HomeController(IHttpContextAccessor httpContextAccessor)
        {           
            _httpContextAccessor =  httpContextAccessor;
            string userName = _httpContextAccessor.HttpContext.User.Identity.Name;     
        }

Leave a comment