Open Closed

Not able to get Current User Id in ApplicationService #297


User avatar
0
lalitChougule created
  • ABP Framework version: v2.7.0
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): no / yes
  • Exception message and stack trace:N.A
  • Steps to reproduce the issue:N.A

Hi,

I am trying to use CurrentUser by using Abp functionality
Volo.Abp.Users.ICurrentUser Volo.Abp.Application.Services.ApplicationService.CurrentUser{get;}

I am not able to get CurrentUser details Please find my code below for reference :

public virtual async Task<SomeDto> GetDetailsByUserId()
{
    var CurrentId = CurrentUser.Id;
    var SomeId = _someRepository.Where(x => x.UserId == CurrentId)
                        .Select(x => x.someData).FirstOrDefault();

    return _someOtherRepository.Where(x => x.SomeId == SomeId).Select(x => x.SomeCode).ToList();
}

2 Answer(s)
  • User Avatar
    0
    lalitChougule created

    Continues for the same question Is there any way to get Current User Id in angular ?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Are you logged in to the application? Can you share the request message? thanks.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11