I have the following server application in C#
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string function = context.Request.QueryString["function"];
Methods m = new Methods();
if (function.Equals("GetAllCreditCards"))
{
ArrayList text = m.GetAllCreditCards();
context.Response.Write(text);
}
}
Basically, when the GetAllCreditCards method is called, it populates an arraylist with data from a database. I checked the method well and it works perfeclty.
I have a client application to which the ArrayList text is sent:
public String returnResponse(HttpWebResponse response)
{
StreamReader stream = new StreamReader(response.GetResponseStream());
String answer = stream.ReadToEnd();
return answer;
}
if (TextBox_Function.Text.Equals("GetAllCreditCards"))
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:4000/Handler.ashx?function=" + TextBox_Function.Text);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String answer = returnResponse(response);
Session["answer"] = answer;
Response.Redirect("Results.aspx");
}
Now, how can the client code be modified so that I extract the ArrayList from the HttpWebResponse? I am currently in the learning phase so please bear with me. Thank you.
The contents of the answer string are currently:
System.Collections.ArrayList