Conectar usando autenticación de Microsoft Windows

El ejemplo siguiente muestra una forma de conectarse a Qlik NPrinting Server usando autenticación de Microsoft Windows en una aplicación de consola .NET. Recuerde sustituir por el nombre real de su Qlik NPrinting Server.

static void Main(string[] args) { //Create the HTTP Request (authenticate) and add required headers ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@ ""); 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(); }