title: httpwebrequest in windows phone 8 app throws "The remote server returned an error: NotFound."?
body: <p>i am developing an windows phone 8 app , in my app i am calling services and downloading some data into my app.</p>
  
  <p>i am testing my app in windows phone 8 emulator, many times it throws this error :</p>
  
  <p><strong>"The remote server returned an error: NotFound."</strong></p>
  
  <p>This is how i have created and used my httpwebrequest :-</p>
  
  <pre><code>public async Task&lt;string&gt; ServiceRequest(string serviceurl, string request, string methodname)
          {
              string response = "";
              try
              {
  
                  var httpwebrequest = WebRequest.Create(new Uri(serviceurl)) as HttpWebRequest;
                  httpwebrequest.Method = "POST";
                  httpwebrequest.Headers["SOAPAction"] = "http://tempuri.org/" + iTestservice + "/" + methodname + "";
                  httpwebrequest.ContentType = "text/xml";
  
  
                  byte[] data = Encoding.UTF8.GetBytes(request);
                  using (var requestStream = await Task&lt;Stream&gt;.Factory.FromAsync(httpwebrequest.BeginGetRequestStream, httpwebrequest.EndGetRequestStream, null))
                  {
                      await requestStream.WriteAsync(data, 0, data.Length);
                  }
  
                  var httpTask = httpRequest(httpwebrequest);
              var completeTask = await Task.WhenAny(httpTask, TaskEx.Delay(300000));
              if (completeTask == httpTask)
                  return await httpTask;
              else
                  httpwebrequest.Abort();
              throw new TimeoutException("Service Timed Out");
  
          }
          catch (TimeoutException Tex)
          {
              throw Tex;
          }
          catch (Exception ex)
          {
              throw ex;
          }
      }
          public async Task&lt;string&gt; httpRequest(HttpWebRequest request)
          {
              string received;
  
              using (var response = (HttpWebResponse)(await Task&lt;WebResponse&gt;.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null)))
              {
                  using (var responseStream = response.GetResponseStream())
                  {
                      using (var sr = new StreamReader(responseStream))
                      {
  
                          received = await sr.ReadToEndAsync();
                      }
                  }
              }
  
              return received;
          }
  </code></pre>
  
  <p><strong>i am really not able to figure what was the issue</strong> </p>
  
  <p>Please note :- </p>
  
  <p>i tried to open the site (service URL which my app is trying to access) in my emulator browser , it opened correctly , i wasn't facing any issues.</p>
  
  <p>1)is that the problem with my code, if so i request you please correct me  ??</p>
  
  <p>2)is this any emulator issue or any connectivity issue ??</p>
  
  <p>3)is this any certification issue opening in emulator ??</p>
  
  <p>Even after a long research to how to fix the issue i was not able to fix it .</p>
  
  <p>Please Help me out.</p>
  
  <p>Thanks in Advance.</p>