/// <summary> /// The main routine of the handler. Creates a request message and sends it to the server. /// </summary> /// <param name="context">The current http context<guer/param> public void ProcessRequest(HttpContext context) { string requestMsg; bool ok = false; string responseMsg; HttpRequest request = context.Request; log = new XWindowsLogger(); config = new XConfig(request, log); srv = new XServerConnection(log, config); if (buildRequestMessage(out requestMsg, request)) { if (srv.connect()) { if (srv.sendMessage(requestMsg)) { if (srv.receiveMessage(out responseMsg)) { if (processResponse(ref responseMsg, context)) { context.Response.Write(responseMsg); ok = true; } } } } } if (!ok) { context.Response.Write(ERRORMSG); } }
private void button1_Click(object sender, EventArgs e) { string response; srv = new XServerConnection(log); srv.connect(); srv.sendMessage(textBox1.Text); response = srv.receiveMessage(); html = response.Substring(response.IndexOf("#H#") + 3); textBox2.AppendText("\r\nRESPONSE:'" + response + "'"); }