public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData, Hashtable httpHeaders)
        {
            Console.WriteLine("POST request: {0}", p.http_url);
            string data = inputData.ReadToEnd();
            NameValueCollection qscoll = HttpUtility.ParseQueryString(data);
            var username = qscoll["username"];
            var password = qscoll["password"];
            var directory = ConfigurationManager.AppSettings["directory"];
            var host = ConfigurationManager.AppSettings["host"];
            var prefix = ConfigurationManager.AppSettings["prefix"];

            // username password kontolü burada yapılıyor.
            if (validateUser(username, password) == 1)
            {

                Helper.WriteErrorLog(username + password + directory + host + prefix);

                // ticket üretilip gönderiliyor.
                QlikSenseTicketRequest ticketexample = new QlikSenseTicketRequest();
                string ticketresponse = ticketexample.TicketRequest("POST", host, username, directory, prefix);
                Helper.WriteErrorLog(ticketresponse);
                Result list = JsonConvert.DeserializeObject<Result>(ticketresponse);
                list.Host = host;
                list.Prefix = prefix;
                string output = JsonConvert.SerializeObject(list);
                p.outputStream.WriteLine(output);

            }
            else
            {
                string noauthenticate = "{\"nouser\":\"1\"}";
                p.outputStream.WriteLine(noauthenticate);

            }
        }
        public override void handleGETRequest(HttpProcessor p)
        {
            if (p.http_url.EndsWith(".png"))
            {
                Stream fs = File.Open(p.http_url.Substring(1, p.http_url.Length - 1), FileMode.Open);
                //	p.writeSuccess("image/png");
                fs.CopyTo(p.outputStream.BaseStream);
                p.outputStream.BaseStream.Flush();
                fs.Close();
            }

            else if (p.http_url.EndsWith(".js") || p.http_url.EndsWith(".css"))
            {

                Stream fs = File.Open(p.http_url.Substring(1, p.http_url.Length - 1), FileMode.Open);
                fs.CopyTo(p.outputStream.BaseStream);
                p.outputStream.BaseStream.Flush();
                fs.Close();
            }

            if (p.http_url.StartsWith("/login"))
            {
                Stream fs = File.Open("login.htm", FileMode.Open);
                //    p.writeSuccess();

                fs.CopyTo(p.outputStream.BaseStream);
                p.outputStream.BaseStream.Flush();
                fs.Close();
            }

            // NameValueCollection querydata = HttpUtility.ParseQueryString("proxyRestUri=https%3a%2f%2fismail-nb.bistratejik.local%3a4243%2fqps%2fdotnet%2f&targetId=f7864213-cec5-4add-ba82-73f02285599d");
            // string proxyRestUri = querydata["proxyRestUri"];
        }
 public abstract void handlePOSTRequest(HttpProcessor p, StreamReader inputData, Hashtable httpHeaders);
 public void listen()
 {
     IPAddress localip = IPAddress.Parse("127.0.0.1");
     listener = new TcpListener(localip, port);
     listener.Start();
     Console.WriteLine("Ticketing service just started and now listening ...");
     while (is_active)
     {
         TcpClient s = listener.AcceptTcpClient();
         HttpProcessor processor = new HttpProcessor(s, this);
         Thread thread = new Thread(new ThreadStart(processor.process));
         thread.Start();
         Thread.Sleep(1);
     }
 }
 public abstract void handleGETRequest(HttpProcessor p);