[I want to submit a form residing on other domain from my asp.net application.] and then get result in my asp.net page(response). I have tried the way in which HTTPWebRequest and HTTPWebResponse objects were used, but no success.
For more clarity, i want to send a container no. to a website providing container tracking and get the result page html in my control.
There is no authentication there. Webite url is "http://www.concorindia .com/containerquery. aspx". Is there any other way to accomplish this?
I am using the code:
For more clarity, i want to send a container no. to a website providing container tracking and get the result page html in my control.
There is no authentication there. Webite url is "http://www.concorindia .com/containerquery. aspx". Is there any other way to accomplish this?
I am using the code:
Code:
string url = "http://www.concorindia.com/containerquery.aspx";
WebRequest request = WebRequest.Create(url);
request.Method = "POST";
string postData = "contno=123456&CONTButton1='Submit Query'";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
response.Wtrite(responseFromServer);