Starts in:
2 DAYS
4 HRS
48 MIN
30 SEC
Starts in:
2 D
4 H
48 M
30 S
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 v9.1.0-preview. Updated on November 20, 2024, 13:06