Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.
I am working on a .Net application that connects to Sense Engine API through Proxy.
I want to programmatically apply a filter to a specified App Field, then I want to see the same selection in the same App opened in a web browser (with the same userid used to connecto to Engine API).
In short terms i want to replicate the same behaviour of two different browser while presenting the same App, if I apply a filter in one browser I can see the selection reflected to second browser.
I dont know why this doesen't work for the session opened with Engine API (it seems a completely separated session).
I am sure that field filtering works because if I programmatically create a snapshot after a selection I can see the snapshotted object with the right filter applyed (but for the problem with session if I want to see the snapshot taht I created with ENGINE API I have first to close all opened session for the user then, when i open again the App in a browser, I can see all the snapshots).
My code for connection (at the moment I using connection via proxy but I have tryed all possible way to connect with the same result):
var aI = location.AppWithId(MyAppId, noVersionCheck: true);
// Default session should beshared with clients
var defaultSession = Session.WithApp(aI, SessionType.Default);
using (var app = location.App(aI, session: defaultSession, noVersionCheck: true))
var field = app.GetField(MyFieldName);
if (field == null) return false;
var result = field.Select(value, true);
var extendedSel = app.GetExtendedCurrentSelection();
var selectedIndex = 0;
foreach (var nxDataPage in extendedSel.GetField(MyFieldName).DataPages)
foreach (var rows in nxDataPage.Matrix)
var cell = rows.FirstOrDefault();
if (cell != null)
if (cell.State == Qlik.Engine.StateEnumType.SELECTED)
selectedIndex = cell.ElemNumber;
I don't know the intrinsic details of the .Net SDK so I can't help you there but perhaps I can shed some light on how session sharing is done.
The Engine will share sessions between connections if they supply the same route and the same http headers.
Route in this case would be the websocket url such as wss://server/app/guid
When connecting over the Proxy it will inject certain http headers documented here
So for your app to be able to share sessions with the connected browser then you would have to supply the same route and emulate the same http headers
Hi Alexander, thanks for answer.
I am investigating the the differences between headers passed from web browser to the Sense Server the headers that .NET Sdk creates in its request. They are different but I am not so expert in web requests.
Can you help me to understand what headers i have to emulate ( and if the route, as you mentioned in your reply, is the part of the string at the right of 'GET' command).
WEB BROWSER request:
GET /sense/app/3772aaff-4027-4b70-8cd9-http://esqsensedev01.infodati.local/sense/app/3772aaff-4027-4b70-8cd9-5d92d75a0fb6/sheet/Jswag/state... HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36
Accept-Encoding: gzip, deflate
HTTP/1.1 200 OK
Cache-Control: public, must-revalidate, max-age=0
Expires: Mon, 01 Jan 0001 00:00:00 GMT
Last-Modified: Wed, 10 May 2017 11:34:40 GMT
Date: Mon, 15 May 2017 15:22:41 GMT
Date: Mon, 15 May 2017 15:22:41 GMT
.NET SDK request:
GET /app/?reloadUri=http%3a%2f%2fesqsensedev01.infodati.local%2fapp%2f HTTP/1.1
User-Agent: NoBrowser Windows
HTTP/1.1 101 Switching Protocols
Wondering if you ever cracked this? I am looking for the exact same thing, but using Node.js (via enigma.js package) to connect to the user’s session.
Uses NTLM to authenticate, chooses whether it's desktop or enterprise. Get's the default app session.
Uri absolutURI = new Uri(this.host);
this.hostLocation = Qlik.Engine.Location.FromUri(absolutURI);
this.hostLocation.AsNtlmUserViaProxy(true, null, false);
2. Open App:
this.appID = this.hostLocation.AppWithNameOrDefault("NameofyourApp", noVersionCheck: true);
if (appID != null)
this.appSession = SessionType.Default;
ISession appSession = Session.WithApp(this.appID, this.appSession);
this.app = (App)hostLocation.App(this.appID, appSession, noData: false, noVersionCheck: true);
3. Filter App:
Get all filters:
var extendedCurrentSelection = this.app.GetExtendedCurrentSelection();
foreach (var field in extendedCurrentSelection.FieldNames)
IEnumerable<NxDataPage> pages = extendedCurrentSelection.GetSelectedData(field, new
foreach (var dataPage in pages)
IEnumerable<NxCell> Cells = dataPage.AllCells();
foreach (var tmpVal in Cells)
Console.WriteLine("Selected value : " + tmpVal.Text);
If you have further questions let me know.