1 Reply Latest reply: May 12, 2017 8:02 PM by Amien Amien RSS

    Connecting to the QRS using a specific NTML account gives 401

    Amien Amien

      //Create the HTTP Request and add required headers and content in xrfkey

      string xrfkey = "0123456789abcdef";

      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://servername.com/QRS/about?xrfkey=" + xrfkey);

      request.Method = "GET";

      request.UserAgent = "Windows";

      request.Accept = "application/json";

      request.Headers.Add("X-Qlik-xrfkey", xrfkey);

       

      request.UseDefaultCredentials = false;

      request.Credentials = new NetworkCredential("username", "secret");

      // make the web request and return the content

      HttpWebResponse response = (HttpWebResponse)request.GetResponse();

      Stream stream = response.GetResponseStream();

      Console.WriteLine(new StreamReader(stream).ReadToEnd());

       

      This is my code, but i keep getting a 401 error. Do i need to add another request.?

      I tried with request.PreAuthenticate