Skip to main content
Nintex Community Menu Bar

Hi,

 

We are using the following code to determine if the current user is admin or not. 

 

System.Security.Principal.WindowsIdentity oUser = System.Security.Principal.WindowsIdentity.GetCurrent();
objErrorLogs.LogAction("Current logged in user name:" + oUser.Name.ToUpper());
string UserName = System.Web.HttpContext.Current.User.Identity.Name.ToString();
UserName = "ETQM"" + UserName;
objErrorLogs.LogAction("Current logged as per http context:" + UserName.ToUpper());
SourceCode.Workflow.Management.WorkflowManagementServer wms = new SourceCode.Workflow.Management.WorkflowManagementServer(sServer, 5555);

using (wms.Connection)
{
wms.Open();
if (wms.IsCurrentUserAdmin())
return true;

}

 

 

The problem is 95% of the time IsCurrentUserAdmin() method is working fine but this function is failing randomly 5% of the time and it is throwing following Exception.

 

Primary Credentials Not Authenticated. Session Not Authenticated.
at SourceCode.Hosting.Client.BaseAPI.BaseAPIConnection.RemoteCall(String TypeName, String MethodName, Object ] Parameters, BooleanB] NullList, MarshalMessageType CallType) at SourceCode.Workflow.Management.WorkflowManagementServer.IsCurrentUserAdmin() at HBMeU_Services.SharedServices.WorkflowEngine.WorkFlowCore.GetUserPermission(Int32 ProcessID, String ProcessName)
 

 

We have checked System.Web.HttpContext.Current.User.Identity.Name.ToString(); property to check if the web application is able to detect currently logged in user or not. We have noticed that we are getting right user name everytime we call  System.Web.HttpContext.Current.User.Identity.Name but K2 API IsCurrentUserAdmin is throwing the above exception randomly and we are not able to determine whether the currrent user is admin or not.

 

Be the first to reply!

Reply