3 Replies Latest reply: Feb 25, 2016 5:41 AM by Lars-Goran Book RSS

    Qlik Sense .NET SDK

    Luke Williams

      Hi,

       

      We are having troubles trying to connect to our Qlik Sense server both remotely and also locally on the server using the .NET SDK. We've tried different combinations of using session headers, direct connections etc but nothing seems to connect. We are also unable to find any example code online that shows exactly how to make the connection.

       

      We use sessions successfully to authenticate our users and provide single sign on, but we are unable to connect to perform admin tasks to reload applications etc

       

      Below is some of the pieces of code we have tried, does anyone know exactly how this should be done?

       

      Thanks for your time

       

                  var sessionUri = new Uri("https://ourserver.com:4243/qps");

       

                  var serverUri = new Uri("wss://ourserver.com");

       

                  var sessionId = Guid.NewGuid().ToString();

       

                  var sessionCreated = new QlikSession(sessionUri).SessionRequest("qlikAdmin", "ANALYTICS", sessionId);

       

                  if(!sessionCreated)

                      throw new Exception("Session could not be created");

       

                  // The session is created succesfully but we are unable to open the hub below

       

                  var location = Location.FromUri(serverUri);

           

                  location.AsDirectConnection("ANALYTICS", "sense_system");

       

                  //location.AsStaticHeaderUserViaProxy("sense_system", "X-Qlik-Session", true);

                  //location.CustomUserHeaders.Add("X-Qlik-Session", sessionId);

                  //location.CustomUserCookies.Add("X-Qlik-Session", sessionId);

       

                  using (IHub hub = location.Hub(noVersionCheck:true))

                  {

                      foreach (IAppIdentifier appIdentifier in location.GetAppIdentifiers())

                      {

                          Console.WriteLine(appIdentifier.AppName);

                      }

                  }