I am creating some AJAX handlers for application functionality, and I want to be able to return responses based on whether an admin user is logged in or not - basically, there is a custom section managing a product database, so handlers for product lists etc. have relevance both in the backend and on the public site - but different relevance.
The problem I'm having is that when I call umbraco.BusinessLogic.User.GetCurrent() I was expecting it to just return null if no user is logged in, but instead I'm getting redirected to login.aspx (which doesn't actually even exist in the public tree, so I am presuming that the redirect assumes the current directory is /umbraco)
Can I avoid this, or is there another non-redirecty way of finding out if an admin user is logged in or not?
umbraco.BusinessLogic.User.GetCurrent() redirecting (v4.7)
I am creating some AJAX handlers for application functionality, and I want to be able to return responses based on whether an admin user is logged in or not - basically, there is a custom section managing a product database, so handlers for product lists etc. have relevance both in the backend and on the public site - but different relevance.
The problem I'm having is that when I call umbraco.BusinessLogic.User.GetCurrent() I was expecting it to just return null if no user is logged in, but instead I'm getting redirected to login.aspx (which doesn't actually even exist in the public tree, so I am presuming that the redirect assumes the current directory is /umbraco)
Can I avoid this, or is there another non-redirecty way of finding out if an admin user is logged in or not?
Hi Rob,
Without knowing if it will return null or do the same redirect, have you tried either of the following methods:
or
? :-)
Haven't tested the return values (if there's any) Just a suggestion.
/ Bo
Hi Bo, thanks for those! On another project today but I'll give them a go when I get a chance.
is working on a reply...