1 Reply Latest reply: Dec 7, 2015 10:12 AM by Philip Flynt RSS

    .net SDK static header authentication help needed

    Philip Flynt

      I am new to the qlik sense server world and I’m currently stuck trying to figure out an issue with the ability to log in using the static header method.  I’m currently using the .net SDK to do my work with the qlik engine to attempt to meet the requirements that have been asked of me on this project and I’m able to connect just fine using the AsNtlmUserViaProxy function.  My problem comes in when I attempt to connect using the AsStaticHeaderUserViaProxy method, I get this error "Connection failed after 4 attempts. Unable to keep connection open: Failed to ensure open connection: One or more errors occurred."  To the best of my knowledge this method only needs the userId and HeaderAuthenticationName.


      I’m not sure what I’m doing wrong but I’ll include what code I have written that works just fine with the NTLM but not the header as well as screen shots of how the virtual proxy is setup in hopes that someone is able to help me figure this out.

      This is just a proof of concept application to show that what is being asked can be done, which I know it can, I just need to figure out how to use this alternate connection method because not everyone connecting to this will be in our active directory.


      Code I’ve written to obtain object data:

      public JsonResult Index()
      String appId = "Testing_app_1";
      IApp app;
      string data = "";


                      ILocation location = Qlik.Engine.Location.FromUri(new Uri("http://<server IP address>/"));

                      location.VirtualProxyPath = "QUP";

                      location.AsStaticHeaderUserViaProxy("qlikusr1", "hdr-usr");

                    //If i comment out the previous two lines and uncomment the following one I connect just fine

                    //and obtain the data that I'm expecting to be able to obtain because of Active Directory

                      //location.AsNtlmUserViaProxy(proxyUsesSsl: false);


                      var appIdentifier = location.AppWithNameOrDefault(appId);

                      if (appIdentifier == null)


                          data = "The app (" + appId + ") does not exist.";

                          return Json(data, JsonRequestBehavior.AllowGet);


                      ISession session = Qlik.Engine.Session.WithApp(appIdentifier, SessionType.Default);

                      app = location.App(appIdentifier, session, noData: false);


                  catch (MethodInvocationException invocationException)


                      data = "Error for details see invocationException.InvocationError.Code.";

                      return Json(data, JsonRequestBehavior.AllowGet);


                  catch (Exception exception)


                      data = exception.Message;

                      return Json(data, JsonRequestBehavior.AllowGet);


                NxAppLayout appLayout = app.GetAppLayout();

                  if (appLayout.IsOpenedWithoutData)


                      data = appId + " - Opened without data";




                      IGenericObject appObject;

                      appObject = app.GetObject<GenericObject>("NdmtmPL");

                      List<string> result = new List<string>();


                      List<NxPage> list = new List<NxPage>();

                      NxPage page = new NxPage();

                      page.Height = 5000;

                      page.Left = 0;

                      page.Top = 0;

                      page.Width = 2;


                      IEnumerable<NxPage> dataPages = list;

                      IEnumerable<NxDataPage> NxDataPage = appObject.GetHyperCubeData("/qHyperCubeDef", dataPages);

                      IEnumerable<NxCellRows> info = NxDataPage.First().Matrix;


                      return Json(info, JsonRequestBehavior.AllowGet);


                  return Json(data, JsonRequestBehavior.AllowGet);