C
Chris Dunaway
I am using the following code to test an .aspx page which has no
presentation and only a handler for the Page_Load event. I am using
this code to POST the contents of an .xml file to the .aspx page.
The page received the file just find and uses Response.Write to send
back a response to indicate it received the file.
I am at a loss to understand how to get this response back from the
WebClient.
I also looked at the HttpRequest class and I can get a response stream
from that, but how do I use that to POST to the .aspx page?
Thanks,
Chris
static void Main(string[] args)
{
WebClient wc = new WebClient();
Stream w =
wc.OpenWrite("http://localhost:2062/TestPage.aspx");
StreamWriter sw = new StreamWriter(w);
using (StreamReader sr = new StreamReader("test.xml"))
{
sw.Write(sr.ReadToEnd());
sw.Flush();
}
sw.Close();
wc.Dispose();
}
presentation and only a handler for the Page_Load event. I am using
this code to POST the contents of an .xml file to the .aspx page.
The page received the file just find and uses Response.Write to send
back a response to indicate it received the file.
I am at a loss to understand how to get this response back from the
WebClient.
I also looked at the HttpRequest class and I can get a response stream
from that, but how do I use that to POST to the .aspx page?
Thanks,
Chris
static void Main(string[] args)
{
WebClient wc = new WebClient();
Stream w =
wc.OpenWrite("http://localhost:2062/TestPage.aspx");
StreamWriter sw = new StreamWriter(w);
using (StreamReader sr = new StreamReader("test.xml"))
{
sw.Write(sr.ReadToEnd());
sw.Flush();
}
sw.Close();
wc.Dispose();
}