Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Qlik Sense .NET SDK

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);

                }

            }

4 Replies
Not applicable

Re: Qlik Sense .NET SDK

Hi,

It could be configuration mistake in your server configuration. I would suggest that you install the server and use Windows as authentication pattern, allow HTTP and in the websocket origin white list add the IP-address for the computer or the hole domain by yourdomain.com and this code should work.

var location = Location.FromUri(new Uri("http://yourserver.com));

location.AsNtlmUserViaProxy();

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

{

     foreach (var appId in location.GetAppIdentifiers())

          Console.WriteLine(appId.name);

}

Best Regards

Lars-Göran Book

Not applicable

Re: Qlik Sense .NET SDK

Any updates to this?  I am running into the same issue.

Not applicable

Re: Qlik Sense .NET SDK

Hi,

have you checked your configuration on the server (QMC)?

Best Regards

Lars-Göran Book

vishva2000
New Contributor

Re: Qlik Sense .NET SDK

This was one of the answer for difference thread, but thought worth having it here for some one who need in the future

--------------------------

I am not well experienced .Net developer(neither C#). However I was able to connect to the server using some of the code provided in https://github.com/AptkQlik/PublicExamples

I used the method in ConnectDirectRemoteServer . However I guess if the SSl is enabled there may be an issue with code. I had to set  certificateValidation: false to the AsDirectConnection method

i.e.

         location.AsDirectConnection("domain", "user", certificateCollection: certificateCollection);

  to

location.AsDirectConnection(“user directory name", "user_id", certificateValidation: false, certificateCollection: certificateCollection);

This code to be worked, need to export certificate into the remote server where you run this code.

Also worth checking the following been setup (I did not want to set allow http in QMC or Windows authentication patterns to windows as it mentioned, but had to allow firewall to accept 4747 port and allow request from my ip to the server)

http://help.qlik.com/en-US/sense-developer/June2017/Subsystems/NetSDKAPI/Content/CodeExamples/Troubl...