tags:

views:

232

answers:

2

I need to post the xml data which i need to get from the database and need to post this data to a url like(http://www.rentals.com/aspx) through asp.net.

+3  A: 

you can write a function like this:

private string SendRequest(Uri UriObj , string data)
        {
            string _result;

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(UriObj);
            request.Method = "POST";
            request.ContentType = "text/xml";
            StreamWriter writer = new StreamWriter(request.GetRequestStream());
            writer.Write(data);
            writer.Close();

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream streamResponse = response.GetResponseStream();
            StreamReader streamRead = new StreamReader(streamResponse);

            _result = streamRead.ReadToEnd().Trim();
            streamRead.Close();
            streamResponse.Close();
            response.Close();
            return _result;
        }

the string data can be xml like "<..>". on .aspx page to get the data, you need to use "Request.InputStream" and read stream into string, xml, etc...

Numenor
A: 

I agree with the answer above. http://www.rental-search.com/

scott