HttpWebRequest class sending the data using streamwriter and getting response from particular URL.
ex..
HttpWebResponse Response = (HttpWebResponse)request.GetResponse();
Stream GetDataStream = Response.GetResponseStream();
StreamReader GetDatafromStream = new StreamReader(GetDataStream);
acknownledgementresp = GetDatafromStream.ReadToEnd();
In ASPX Page
System.IO.Stream str;
Int32 strLen, strRead;
str = Request.InputStream;
strLen = Convert.ToInt32(str.Length);
byte[] strArr = new byte[strLen];
strRead = str.Read(strArr, 0, strLen);
string DataReceived = System.Text.Encoding.Default.GetString(strArr);
Response.ContentType = "text";
Response.Clear();
Response.BufferOutput = false;
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(ReceivedData);
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.Flush();
Response.End();
ex..
string strUrl="website";
HttpWebRequest request = WebRequest.Create(string.Format(strUrl, "valid")) as HttpWebRequest;
request.Method = strMethod;
request.ContentType = "text/xml; charset=utf-8";
request.ContentLength = PostData.Length;
request.KeepAlive = false;
writer = new StreamWriter(request.GetRequestStream());
writer.Write(PostData);
writer.Close();
HttpWebResponse Response = (HttpWebResponse)request.GetResponse();
Stream GetDataStream = Response.GetResponseStream();
StreamReader GetDatafromStream = new StreamReader(GetDataStream);
acknownledgementresp = GetDatafromStream.ReadToEnd();
In ASPX Page
System.IO.Stream str;
Int32 strLen, strRead;
str = Request.InputStream;
strLen = Convert.ToInt32(str.Length);
byte[] strArr = new byte[strLen];
strRead = str.Read(strArr, 0, strLen);
string DataReceived = System.Text.Encoding.Default.GetString(strArr);
Response.ContentType = "text";
Response.Clear();
Response.BufferOutput = false;
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(ReceivedData);
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.Flush();
Response.End();