2 Replies Latest reply: May 15, 2017 8:44 AM by Fabio Cavallari RSS

    Net SDK session shared with client

    Fabio Cavallari

      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.

        • Re: Net SDK session shared with client
          Mattias Wennmo

          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

            • Re: Net SDK session shared with client
              Fabio Cavallari

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