Author: bzinchenko | Posted on: 12/22/2009 2:59:05 AM | Views : 876

Hello everybody 
I m writing desktop frontend to ASP.NET web application. I do not want using web service for hosting portability reasons. I want to send data to application through POST request instead.
On client side i write:
public static string PostData(string sURL, string sData) { string result = ""; //string sData = "x=1&y=2&z=Ok"; try { // prepare request HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create(sURL); wreq.Method = "POST"; wreq.ContentType = "application/x-www-form-urlencoded"; wreq.ContentLength = sData.Length; // post to server Stream sw = wreq.GetRequestStream(); StreamWriter wr = new StreamWriter(sw); wr.Write(wr); wr.Close(); // get response HttpWebResponse httpResponse = (HttpWebResponse)wreq.GetResponse( ...

Go to the complete details ...