Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Net SDK session shared with client

I'm working on a .Net application that apply a specific filter value for a field programmatically.

I supposed to see the same filter applyed in my browser client session, but it doesen't work.

I want to replicate the same behaviour that happens when you have the same app opened in two different browser and you apply a selection in one browser. You can see the same selection replicated to second browser (same session called "Default Session").

My code to connect via proxy (i tryed direct access to engine too):

var uri = new Uri($"{senseServerUri}");

location = Qlik.Engine.Location.FromUri(uri);

var proxyUsesSSL = senseServerUri.ToLower().Contains("https:");

location.AsNtlmUserViaProxy(proxyUsesSsl: proxyUsesSSL, certificateValidation: false, loginCredentials: new NetworkCredential(userDirectory + "\\" + userName, password));

At the moment i tryed a lot of different approach to open the App and working with this one.

In this sample we use the default session:

using (var app = location.App(aI, session: defaultSession, noVersionCheck: true))

    {

     var field = app.GetField(fieldName);

     var result = field.Select(value, true);

    }

I dont know why this selection is not visible in the browser if I open from hub the same App (while .Net application is running).

By the way i am sure that the selection is applyed because if I create a snapshot (via Net Sdk) after selection I can see the snapshotted object (after closing all the browser and sessions) with the right filter applyed.

5 Replies
Highlighted
Employee
Employee

Re: Net SDK session shared with client

Hello Fabio,

Are you using Session to attach to the engine session?

Can you try the following:

ISession _session = Session.WithApp(aI, SessionType.Default);

And then use _session when opening the app.

Regards,

Mattias

Highlighted
Not applicable

Re: Net SDK session shared with client

Hello Mattias,

yes I am using the default session (I omitted the session assignment in previous post sorry) at the moment.

var aI = location.AppWithId(qlikSenseAppId, noVersionCheck: true); 

var defaultSession = Session.WithApp(aI, SessionType.Default);

I tried the custom session too (adding the parameter '&identity=MyCustomSession' in the 'Single' url) but it doesen't seem to share the same engine session:

var customAppSession = Session.WithApp(aI, "MyCustomSession");

Highlighted
MVP & Luminary
MVP & Luminary

Re: Net SDK session shared with client

Fabio,

Did you ever get this to work?  I'm trying to figure out the best way to connect to an app repeated times without hitting the 5 logon limit. 

-Rob

Highlighted
Employee
Employee

Re: Net SDK session shared with client

I see you are adding network credentials to your AsNtlmUserViaProxy call. Are you sure you end up with the same user as the one you get when you go through a browser?

Other than that it looks correct to me. I seem to remember that there was an issue with the session matching in some older version of Qlik Sense though, so just to be sure: which version are you running?

Anyway, for reference, here is the exact code I used for connecting to the client session during my talk at Qonnections this year: https://github.com/kolsrud/qonnections2018_demo/blob/master/QonnectionsDemo/Program.cs

That program connects to a desktop and the selection performed at the last line is reflected in the Qlik Sense client.

Highlighted
Employee
Employee

Re: Net SDK session shared with client

I don't think there are any ways around that I'm afraid. Other than keeping the WebSocket open that is.