If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Logon c#

Started by Ashes, 06 Feb 2008 12:51:59 AM

Previous topic - Next topic

Ashes

Hi.

I am a developer and not a Cognos expert - so f my cognos knowledge sounds sketchy, it is!

I have been struggeling with this for too long now!!!
I am tryng to make a connection to Cognos to retrieve a list of reports in a predifined folder.

With anon acess turned on, I can connect, and if I pass a namespace, username, and password I can connect, here in lies the problem though.

I am using AD as a the security model, and have set that up that the user does not have to type in a username and password. In the application I am writing, I want the user to not have to "log in" again, and have set Anon Access off (in IIS)

How do I connect without passing username and password to the Logon function????



Here is my current code.


public void Connect()
{
  bool    bTestAnonymous  = false;
 
  string defaultUserName  = "test";
  string defaultPassword  = "test";
  string defaultNamespace = "test";

  contentManagerService1 cman = new contentManagerService1();
  cman.Url = "http://XXXXXXXXXX/cognos8/cgi-bin"; //have also tried to dispatcher

  try
  {
    searchPathMultipleObject homeDirSearchPath = new searchPathMultipleObject();

    homeDirSearchPath.Value = "~";

    baseClass[] bc = cman.query(homeDirSearchPath, new propEnum[] { }, new sort[] { }, new queryOptions());

    if(bc != null)
      bTestAnonymous = true;
  }
  catch(Exception)
  {
    bTestAnonymous = false;
  }


  if(!bTestAnonymous)
  {
    System.Text.StringBuilder credentialXML = new System.Text.StringBuilder("");
    credentialXML.Append("<credential>");
    credentialXML.AppendFormat("<namespace>{0}</namespace>", defaultNamespace);
    credentialXML.AppendFormat("<username>{0}</username>",   defaultUserName);
    credentialXML.AppendFormat("<password>{0}</password>",   defaultPassword);
    credentialXML.Append("</credential>");

    xmlEncodedXML xmlEncCred = new xmlEncodedXML();
    xmlEncCred.Value = credentialXML.ToString();

    cman.logon(xmlEncCred, null);

  }
}

COGNOiSe administrator

I think you should be executing a simple query (aka Anonymous Logon) against a URI enabled for Integrated Windows Authentication. Thry searching for WindowsIdentity and how to apply it to your cman.