Hi,
I'm trying to get the current user and the current portal id with DnnApiController, but it works only for the main site.
How I tested:
- new install of DNN 8.0., at http://localhost/dnn8/ >>> create "user1" in main site
- created one child site (http://localhost/dnn8/site2) >>> create "user2"
The code I used (and other methods, similar to it):
[HttpGet]
[AllowAnonymous]
public int GetUserId()
{
return UserController.Instance.GetCurrentUserInfo().UserID;
//return base.UserInfo.UserID;
}
- main site: authenticate with "user1" and the call, directly in the browser: http://localhost/dnn8/DesktopModules/AdmitereDNNAPI/API/AdmitereDNNAPI/GetUserId >>it works, because it returns an integer
- child site: authenticate with "user2" (in private / incognito..) and and the call, directly in the browser, is a second tab: http://localhost/dnn8/DesktopModules/AdmitereDNNAPI/API/AdmitereDNNAPI/GetUserId >> it doesn't work as it always returns -1 AND the user is disconnected from the first tab (if I try to navigate to another page, the user in the upper-right-corner is no longer displayed)
If I try to get the portalId, it returns 0 for both the main and child site.
I've tried http://jimfrenette.com/2013/07/dnn-windows-client/ ==>
<modules runAllManagedModulesForAllRequests="true"> and it doesn't work
Also, from http://www.dnnsoftware.com/community-blog/cid/144400/webapi-tips I've tried to use [DnnAuthorize], but it doesn't work either - the user is disconnected in the first tab, and the message from the request in the second tab is Authorization has been denied for this request.
Help, please
Catalin