Why AbpSession.UserId is null in my Application layer? I disabled multytenancy!
6 Answer(s)
-
0
this code
Thread.CurrentPrincipal.Identity.GetUserId()Returns null and
Thread.CurrentPrincipal.Identity.IsAuthenticatedis False !
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
It will be null if user did not login or IAbpSession is not implemented (if you're using module-zero, then it's implemented). If Thread.CurrentPrincipal.Identity.IsAuthenticated is false, that shows user not logged in.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thank You, but User is logged in and U use module-zero
I create it from Templates
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I found the problem! The problem is that I want to get Current user Information in NavigationProvider to generate menu items according to user Roles ! and when NavigationProvider Creates menu No user is Logged in.
So my question changed to this:
HOW CAN I GENERATE MENU ACCORDING TO USER ROLES?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
You can not get UserId in NavigationProvider since it's executed once on application startup, independent from users.
You can use permissions (instead of roles) to authorize menu items. See Navigation document: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Navigation">http://www.aspnetboilerplate.com/Pages/ ... Navigation</a>
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
<cite>hikalkan: </cite> Hi,
You can not get UserId in NavigationProvider since it's executed once on application startup, independent from users.
You can use permissions (instead of roles) to authorize menu items. See Navigation document: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Navigation">http://www.aspnetboilerplate.com/Pages/ ... Navigation</a>
Thank You So Much ! I didn't notice that !
You Are So Fantastic...
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)