Getting current users id has been made very simple with Microsoft.AspNet.Identity.Core nuget package,
First off install the nuget package
Install-Package Microsoft.AspNet.Identity.Core
Now add this using directive in class
And finally fetch the current users id by
First off install the nuget package
Install-Package Microsoft.AspNet.Identity.Core
Now add this using directive in class
using Microsoft.AspNet.Identity;
And finally fetch the current users id by
HttpContext.Current.User.Identity.GetUserId();
No comments:
Post a Comment