<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Qlik Sense: Connect to .NET SDK with dynamic header authentication in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Connect-to-NET-SDK-with-dynamic-header-authentication/ta-p/1712284</link>
    <description>&lt;P&gt;This is an example of how to connect to Qlik Sense using Dynamic header authentication with the .NET SDK&lt;BR /&gt;&lt;BR /&gt;The following must be installed to test the example provided in this article:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Microsoft Visual Studio (The community version can be used)&lt;/LI&gt;
&lt;LI&gt;Qlik Sense Server&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;BR /&gt;*It does not need to be installed on the same machine, but proper ports must be open for incoming connection on the Qlik Sense server side.&lt;BR /&gt;*Qlik Sense certificates need to be installed on the machine running Microsoft Visual Studio for the connection to be trusted.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Environments:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV style="margin-left: 40px;"&gt;Qlik Sense Enterprise any version&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3 class="qlik-migrated-tkb-headings"&gt;Resolution:&lt;/H3&gt;
&lt;P&gt;&lt;BR /&gt;The example below is created based on the console application (.NET framework) template. Please note that the Qlik Sense .NET SDK also need to be installed. (For details, see&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Support-Knowledge-Base/Qlik-Sense-Getting-started-with-the-NET-SDK/ta-p/1716231" target="_blank" rel="noopener"&gt;Qlik Sense: Getting started with the .NET SDK&lt;/A&gt;&amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;using System;
using Qlik.Engine;
using Qlik.Engine.Communication;

namespace ConnectServerNTLM
{
    class Program
    {
        static void Main(string[] args)
        {
            var uri = new Uri("https://qlikserver1.domain.local");

            if (args.Length &amp;gt; 0)
            {
                uri = new Uri(args[0]);
            }
            ILocation location = Qlik.Engine.Location.FromUri(uri);
            location.CustomUserHeaders.Add("hdr-usr", "DOMAIN\\myuser2");
            location.AsNtlmUserViaProxy();
            location.VirtualProxyPath = "hdr";

            PrintQlikSenseVersionNumber(location);
        }
        
        private static void PrintQlikSenseVersionNumber(ILocation location)
        {
            try
            {
                using (IHub hub = location.Hub(noVersionCheck: true))
                {
                    Console.WriteLine(hub.ProductVersion());
                }
            }
            catch (CommunicationErrorException cex)
            {
                Console.WriteLine("Can not connect to Qlik Sense instance, check that Qlik Sense is running." + Environment.NewLine + cex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("General error." + Environment.NewLine + ex.Message);
            }
            Console.ReadLine();
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;On the Qlik Sense side, a virtual proxy with dynamic header authentication needs to be configured correctly. See below an example of configuration:&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;&lt;STRONG&gt;AUTHENTICATION&lt;/STRONG&gt;
&lt;STRONG&gt;Anonymous access mode:&lt;/STRONG&gt; No anonymous user
&lt;STRONG&gt;Authentication method:&lt;/STRONG&gt; Header authentication dynamic user directory
&lt;STRONG&gt;Header authentication header name:&lt;/STRONG&gt; hdr-usr
&lt;STRONG&gt;Header authentication dynamic user directory:&lt;/STRONG&gt; $ud\\$id&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 09:11:17 GMT</pubDate>
    <dc:creator>Damien_V</dc:creator>
    <dc:date>2021-02-23T09:11:17Z</dc:date>
    <item>
      <title>Qlik Sense: Connect to .NET SDK with dynamic header authentication</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Connect-to-NET-SDK-with-dynamic-header-authentication/ta-p/1712284</link>
      <description>&lt;P&gt;This is an example of how to connect to Qlik Sense using Dynamic header authentication with the .NET SDK&lt;BR /&gt;&lt;BR /&gt;The following must be installed to test the example provided in this article:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Microsoft Visual Studio (The community version can be used)&lt;/LI&gt;
&lt;LI&gt;Qlik Sense Server&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;BR /&gt;*It does not need to be installed on the same machine, but proper ports must be open for incoming connection on the Qlik Sense server side.&lt;BR /&gt;*Qlik Sense certificates need to be installed on the machine running Microsoft Visual Studio for the connection to be trusted.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Environments:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV style="margin-left: 40px;"&gt;Qlik Sense Enterprise any version&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3 class="qlik-migrated-tkb-headings"&gt;Resolution:&lt;/H3&gt;
&lt;P&gt;&lt;BR /&gt;The example below is created based on the console application (.NET framework) template. Please note that the Qlik Sense .NET SDK also need to be installed. (For details, see&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Qlik-Support-Knowledge-Base/Qlik-Sense-Getting-started-with-the-NET-SDK/ta-p/1716231" target="_blank" rel="noopener"&gt;Qlik Sense: Getting started with the .NET SDK&lt;/A&gt;&amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;using System;
using Qlik.Engine;
using Qlik.Engine.Communication;

namespace ConnectServerNTLM
{
    class Program
    {
        static void Main(string[] args)
        {
            var uri = new Uri("https://qlikserver1.domain.local");

            if (args.Length &amp;gt; 0)
            {
                uri = new Uri(args[0]);
            }
            ILocation location = Qlik.Engine.Location.FromUri(uri);
            location.CustomUserHeaders.Add("hdr-usr", "DOMAIN\\myuser2");
            location.AsNtlmUserViaProxy();
            location.VirtualProxyPath = "hdr";

            PrintQlikSenseVersionNumber(location);
        }
        
        private static void PrintQlikSenseVersionNumber(ILocation location)
        {
            try
            {
                using (IHub hub = location.Hub(noVersionCheck: true))
                {
                    Console.WriteLine(hub.ProductVersion());
                }
            }
            catch (CommunicationErrorException cex)
            {
                Console.WriteLine("Can not connect to Qlik Sense instance, check that Qlik Sense is running." + Environment.NewLine + cex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("General error." + Environment.NewLine + ex.Message);
            }
            Console.ReadLine();
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;On the Qlik Sense side, a virtual proxy with dynamic header authentication needs to be configured correctly. See below an example of configuration:&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;&lt;STRONG&gt;AUTHENTICATION&lt;/STRONG&gt;
&lt;STRONG&gt;Anonymous access mode:&lt;/STRONG&gt; No anonymous user
&lt;STRONG&gt;Authentication method:&lt;/STRONG&gt; Header authentication dynamic user directory
&lt;STRONG&gt;Header authentication header name:&lt;/STRONG&gt; hdr-usr
&lt;STRONG&gt;Header authentication dynamic user directory:&lt;/STRONG&gt; $ud\\$id&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 09:11:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-Connect-to-NET-SDK-with-dynamic-header-authentication/ta-p/1712284</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2021-02-23T09:11:17Z</dc:date>
    </item>
  </channel>
</rss>

