cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Can't authenticate using secWinAD protocol with .Net SDK

first_last
Participant
0 Likes
3,706

I'm attempting to authenticate using a .Net client.

The relevant code:

ISessionMgr sessionMgr = CrystalEnterprise.GetSessionMgr();  
IEnterpriseSession enterpriseSession = sessionMgr.Logon([userName], [password], [server:6400], [authentication]);

If I use an account with secWinAD credentials, I get an error on the Logon line that reads:

System.ArgumentNullException: 'Value cannot be null.Parameter name: assembly'

If I use an account with secEnterprise credentials, however, the Logon method works.

I noticed that the secWinAD protocol isn't installed:

sessionMgr.InstalledAuthProgIds
{string[1]}
  [0]: "secEnterprise"

I've added the CrystalDecisions.Enterprise.Auth.secWinAD assembly to the project's reference.

When I use the RESTful SDK, I can access this server w/ the AD account.

What am I missing? Is there a way to programmatically add the secWinAD auth?

View Entire Topic
first_last
Participant
0 Likes

I solved this problem, which I think was related to incompatible assemblies (as Shawn and Dan mentioned).

using CrystalDecisions.Enterprise;

try
{
  // create a new instance, rather than use singleton (which was from another assembly)
  SessionMgr sessionMgr = new SessionMgr();

  // use IS* interface, rather than the I* interface (which was from another assembly)
  // secWinAD works as expected
  ISEnterpriseSession enterpriseSession = sessionMgr.Logon("account", "password", "cmsName", "secWinAD");

  return enterpriseSession.LogonTokenMgr.DefaultToken;
}
// SDKException wasn't necessary
catch (Exception e)
{
  Debug.Print(e.Message);
  throw;
}