title: HttpWebRequest: Access denied on release build - Xamarin (Android)
body: <p>I'm trying to develop a simple app for Android with Xamarin. The app makes a HTTP request to a Web API.</p>
  
  <p>Here is the main code:</p>
  
  <pre><code>            var messageTxt = FindViewById&lt;EditText&gt;(Resource.Id.message);
              var apiUrlTxt = FindViewById&lt;EditText&gt;(Resource.Id.apiurl);
  
              var url = String.Format("{0}/api/values/{1}", apiUrlTxt.Text, messageTxt.Text);
              var j = await FetchApi(url);
  
              var apiReturn = FindViewById&lt;TextView&gt;(Resource.Id.apiReturn);
              apiReturn.Text = j;
  </code></pre>
  
  <p>And here is the FetchApi method:</p>
  
  <pre><code>private async Task&lt;string&gt; FetchApi(string url)
      {
          try
          {
              var request = HttpWebRequest.Create(url);
              request.ContentType = "application/json";
              request.Method = "GET";
              request.Timeout = 10000;
  
              using (var response = await request.GetResponseAsync())
              {
                  using (var s = response.GetResponseStream())
                  {
                      return await Task.Run(() =&gt; JsonObject.Load(s));
                  }
              }
          }
          catch(Exception ex)
          {
              return await Task.Run(() =&gt; "Erro - " + ex.Message);
          }
      }
  </code></pre>
  
  <p>I'm running the app on a external device.
  Everything works great on the Debug mode, but when I switch to Release, the HttpWebRequest returns an WebException with message <strong>"Error: ConnectFailure (Access denied)"</strong></p>
  
  <p>I've already tried to set the Packaging and Linker options the same for the Debug and the Release mode, but the Debug version continues to work, and the Release version continues to fail.</p>
  
  <p>I also tried to set the Linking to None in Release mode, but it also didn't work.</p>
  
  <p>Am I missing something here?</p>