6 Replies Latest reply: Apr 27, 2016 5:15 AM by Simon Child RSS

    The remote server returned an error: (403) Forbidden.

    Simon Child

      Hi All


      I am trying to set up webtickets for our Qlik sense installation. I have a working virtual proxy set up pointing to my authentication application in the cloud.


      A request to Qlik via the proxy redirects to auth app.

      The app trys to request a ticket from myqlikserver.net:4243/qps/ticket but I get the error message The remote server returned an error: (403) Forbidden.


      Is myqlikserver.net:4243/qps/ticket where i should be requesting the ticket from?  Am I missing some part of the process or a setting that needs enabling?


      Below if the code used to request the ticket.


      private string GetTicket(string user, string method, string ticketinguser, string ticketingpassword, string apiUrl)


                  string result = string.Empty;

                  XDocument doc = new XDocument();



                      string webTicketXml = string.Format("<Global method=\"GetWebTicket\"><UserId>{0}</UserId></Global>", user);


                      System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);


                      HttpWebRequest client = (HttpWebRequest)WebRequest.Create(new Uri(apiUrl));

                      X509Store keystore = new X509Store(StoreLocation.CurrentUser);

                      X509CertificateCollection certs = keystore.Certificates.Find(X509FindType.FindBySubjectName, "QlikClient", true);


                      client.PreAuthenticate = true;

                      client.Method = method;

                      client.ClientCertificates = certs;

                      client.UserAgent = "thars-auth";

                      client.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;


                      client.Credentials = new NetworkCredential(ticketinguser, ticketingpassword);

                      client.UseDefaultCredentials = true;

                      if (method == "POST")


                          using (StreamWriter sw = new StreamWriter(client.GetRequestStream()))



                      StreamReader sr = new StreamReader(client.GetResponse().GetResponseStream());

                      result = sr.ReadToEnd();


                      doc = XDocument.Parse(result);

                      return doc.Root.Element("_retval_").Value;


                  catch (Exception e)



                      var sb = new StringBuilder();

                      sb.Append("<h1>An error occured contacting the Qlik Sense Server</h1>");



                      if (e.InnerException != null)










                      apiURL = apiUrl;


                      ContentDiv.InnerHtml = sb.ToString();


                  return null;