Hi,
I want to post data to
http://ndncregistry.gov.in/ndncregistry/search.miscin Window
Application
It checks if phone no is registered with particular website.
So i wrote the following code.(*Webbrowser is not to be used -According to
requirement)*
But it is not working.Can somebody help me.
*
private void button3_Click(object sender, EventArgs e)
{
string postData = "9999774442";
ASCIIEncoding encoding = new ASCIIEncoding();
//string postData = strId;
byte[] data = encoding.GetBytes(postData);
// Prepare web request...
try
{
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("
http://ndncregistry.gov.in/ndncregistry/search.misc");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
}
catch (Exception ex)
{
}
String post_response;
HttpWebResponse objResponse =
(HttpWebResponse)myRequest.GetResponse();
using (StreamReader responseStream = new
StreamReader(objResponse.GetResponseStream()))
{
post_response = responseStream.ReadToEnd();
responseStream.Close();
}
}
Thanks
Pratiksha
(M) 9999774442
*