المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : XML Post



C# Programming
07-10-2009, 03:18 PM
Hi all,

I have the following
sda.fill(ds);
string xmlDs = ds.GetXml();

WebRequest req = null;
WebResponse rsp = null;


try
{
string fileName = xmlDs;
string uri = "http://www.website.com/Pages/CongratulationsListener.aspx";
req = WebRequest.Create(uri);
//req.Proxy = WebProxy.GetDefaultProxy(); // Enable if using proxy
req.Method = "POST"; // Post method
req.ContentType = "text/xml"; // content type
// Wrap the request stream with a text-based writer
StreamWriter writer = new StreamWriter(req.GetRequestStream());
// Write the XML text into the stream
writer.WriteLine(fileName);
writer.Close();
// Send the data to the webserver
// SendRequest(uri);
rsp = req.GetResponse();
rsp.Close();

}
catch (WebException webEx)
{

}
catch (Exception ex)
{

}
finally
{
if (req != null) req.GetRequestStream().Close();
if (rsp != null) rsp.GetResponseStream().Close();

}
My listner page (CongratulationsListener.aspx) doesnt seem to get any Xml data?
Can any one advice please?

Thank you in advance.