I want to get the user data which is currently logged in,, ?? I have to send current user ID to a table in database How to do this??
Asp.Net Boilerplate,, How to Get current Login User?
11.2k views Asked by MMG At
3
There are 3 answers
1
On
In custom classes use the code below to get current user id
public class MyClass : ITransientDependency
{
public IAbpSession AbpSession { get; set; }
public MyClass()
{
AbpSession = NullAbpSession.Instance;
}
public void MyMethod()
{
var currentUserId = AbpSession.UserId;
//...
}
}
In application services you don't need to inject AbpSession just use AbpSession public property
AbpSession.TenantId
AbpSession.UserId
Here is the answer to the Question