Skip to main content

Connecting using Microsoft Windows authentication

The following example shows one way of connecting to the Qlik NPrinting Server using Microsoft Windows authentication in a .NET console application. Remember to substitute server.name.com with your actual Qlik NPrinting Server name.

static void Main(string[] args) { //Create the HTTP Request (authenticate) and add required headers ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@ "https://server.name.com:4993/api/v1/login/ntlm"); request.Method = "GET"; request.UserAgent = "Windows"; request.Accept = "application/json"; // specify to run as the current Microsoft Windows user request.UseDefaultCredentials = true; try { // make the web request and return the content HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader responseReader = new StreamReader(response.GetResponseStream()); string sResponseHTML = responseReader.ReadToEnd(); Console.WriteLine(sResponseHTML); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.Read(); }