What is Wrong with it ....
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(________________________ URL with STRING ________________________________);
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse(); // Intelisence doesn't show GetResponse()
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
Even in Object Window there is no GetResponse() method , but i do get in Windows Form /WPF section !!
Loading


Sunny SharmaRank #223 · 11.1K reputationPosted Jul 11, 2013, 6:32 AM EDT
See this post, it's nicely explained:
http://stackoverflow.com/questions/5971866/cant-find-httpwebrequest-getresponse-in-wp7-project
Hope it helps.
Sunny SharmaRank #223 · 11.1K reputationPosted Jul 11, 2013, 3:13 AM EDT
I hope you didn't miss addiong a reference to System.Net namespace. Do check the for the dll under references section in Solution Explorer, add it manually if not there and it will work.
Hope it helps.
Cheers!
VulpesRank #55 · 29.2K reputationPosted Jul 11, 2013, 3:53 AM EDT
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.95).aspx
Silverlight and Windows Phone programming are not my thing but I'd imagine you have to use the asynchronous BeginGetResponse method instead.
Abhishek Kumar RaviRank #251 · 10K reputationPosted Jul 11, 2013, 4:38 AM EDT
Abhishek Kumar RaviRank #251 · 10K reputationPosted Jul 11, 2013, 6:28 AM EDT
Abhishek Kumar RaviRank #251 · 10K reputationPosted Jul 11, 2013, 6:44 AM EDT
Sunny SharmaRank #223 · 11.1K reputationPosted Jul 11, 2013, 10:01 AM EDT
You can modify your code like this: (I have implemented it in console app for demo)
-----------------------------------------------
Hope it helps.
Abhishek Kumar RaviRank #251 · 10K reputationPosted Jul 11, 2013, 4:30 PM EDT
{
HttpWebRequest myReq=(HttpWebRequest) WebRequest.Create("__________URL______");
myReq.BeginGetResponse(new AsyncCallback(FinishedWebRequest),myReq);
if(_responseString.ToString()=="1")
error=false;
MessageBox.Show(">> SEND() Completed");
}
catch
{
MessageBox.Show("ERROR: Server Busy :(");
}
}
static void FinishedWebRequest(IAsyncResult result)
{
MessageBox.Show(">> Request Sent");
HttpWebResponse response = (HttpWebResponse)(result.AsyncState as HttpWebRequest).EndGetResponse(result);
using (StreamReader sReader = new StreamReader(response.GetResponseStream()))
{
_responseString = sReader.ReadToEnd();
MessageBox.Show(">>Response Accepted");
}
}
_____________________________
Not working , Neither showing any exception nor any error. Just hault the screen .. :(