I am using httpwebrequest and httpwebresponse objects for sending data to remote appication by post and receiving the response from there.
I am using this code in my windows application which will send a request to remote application.
---------------------------------------------------------------------------------------------------------------
string lcUrl = "http://localhost/check/WebSite3/Default.aspx";
HttpWebRequest loHttp =(HttpWebRequest)WebRequest.Create(lcUrl);
// *** Send any POST data
string lcPostData = "name=sanjay";
loHttp.Method = "POST";
loHttp.Headers.Add("key", "keyvalue");
loHttp.ContentType = "text/html";
byte[] lbPostBuffer = System.Text.Encoding.GetEncoding(1252).GetBytes(lc PostData);
byte[] getData = System.Text.Encoding.GetEncoding(1252).GetBytes("" );
loHttp.ContentLength = lbPostBuffer.Length;
Stream loPostData = loHttp.GetRequestStream();
loPostData.Write(lbPostBuffer, 0, lbPostBuffer.Length);
loPostData.Flush();
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream =new StreamReader(loWebResponse.GetResponseStream(), enc);
string lcHtml = loResponseStream.ReadToEnd();
MessageBox.Show(loWebResponse.ResponseUri.ToString ());
MessageBox.Show(lcHtml);
loWebResponse.Close();
loResponseStream.Close();
------------------------------------------------------------------------------------------------------------------
In this code i am sending a string "name" with value "sanjay" to my local server
http://localhost/check/WebSite3/Default.aspx.
I am writing this code on my application ---
-------------------------------------------------------------------------------------------------------------
Label1.Text = Request.Form("name")
--------------------------------------------------------------------------------------------------------------
but on the web page i am not getting any data by post.
but i am getting a proper respose from my remote application and on my windows application' msz box it is showing all the source code of my web application.
So plz tell me where my code is wrong and how i can send a proper value as a response to my calling application.