View Full Version : Reading an XML post in an ASP.NET web site

Nov 3rd, 2005, 09:27 PM
I desperately need some help on this. I have a website that will recieve votes via sms (text messages). The person voting will send a message to a certain number which will then forward on an xml post to an address I have specified.

I've sent up an aspx file at this point with a form on it. I know how to look through the xml and get out the data I need but what I need help with is how I read that XML post in the first place. How to I get the aspx file to capture the XML post and then allow me to read through it?


Nov 3rd, 2005, 09:49 PM
Are you trying to read XML from a remote URL?


Nov 3rd, 2005, 09:57 PM
No, what will happen is that after an sms is recieved an xml message will be sent to the url that I've specified. As it won't be saving an xml file for me to read I'm at aloss to figure out how to read the data and then add it to my database

Nov 4th, 2005, 03:02 AM
this article (http://samples.gotdotnet.com/quickstart/howto/doc/Xml/ReadXMLStream.aspx) should help with the xml part of reading

here is the database part

Dataset myDataset = new Dataset( );
myDataset.ReadXml( streamobject ); // think that's how it works...
// display results in a datagrid
myDataGrid.DataSource = myDataset.Tables[0].DefaultView;
myDataGrid.DataBind( );

string strConnection = " your database connection ";
OleDbConnection objConnection = new OleDbConnection( strConnection );
OleDbCommand objCommand = new OleDbCommand(objConnection );
objCommand.CommandText = "INSERT INTO ..."

hope this helps

Nov 4th, 2005, 07:14 AM
Thanks for that but getting the data into the database isn't the issue I'm having difficulty with. Its how I read the XML post in the first place

Nov 15th, 2005, 04:39 AM
How is XML data passed to your site? Is it submitted to you via POST (upload form or normal form submission?) or GET or what?