using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Net;
using System.IO;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//using FIT namespace here
namespace FIT.AcceptanceTest
{
///
/// Summary description for FIT.
///
public class FITHandler : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
/*
on http request for run
retrieve the http_referrer from the request
retrieve that page as input
*/
string input = FetchNetworkContent(Request.UrlReferrer.ToString());
/*
Parse tables = new Parse(input);
(new Fixture()).doTables(tables);
retrieve the response stream from the request
*/
//Needs work here
string response = "Instantiate Parse and call doTables here";
/*
tables.print(response);
*/
Response.Write(response); //Or something like this.
}
public string FetchNetworkContent(string url)
{
WebRequest netRequest = WebRequest.Create(url);
WebResponse netResponse = netRequest.GetResponse();
try
{
Stream receiveStream = netResponse.GetResponseStream();
byte [] read = new Byte[512];
string content = "";
int bytes = 0;
do
{
bytes = receiveStream.Read(read, 0, 512);
content += System.Text.Encoding.ASCII.GetString(read, 0, bytes);
}
while (bytes > 0);
return content;
}
catch (Exception)
{
return null;
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}