title: Cleartext HTTP traffic to xxxx not permitted at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod
body: <p>i am just new to xamarian mobile application development. i have simple task to done just login functionality but i can't achieve the goal. i du the stuff as like in MainPage.xml</p>
  <pre><code> public async void BtnLogin_Clicked(object sender, EventArgs e)
          {
              //var vm = new LoginViewModel();
              //this.BindingContext = vm;
  
              
              string email = string.Empty, password = string.Empty;
  
              email = Email.Text;
              password = Password.Text;
  
              if (!string.IsNullOrEmpty(email) &amp;&amp; !string.IsNullOrEmpty(password))
              {
                  try
                  {
                     
                      string WebAPIUrl = &quot;http://smartentry.visitmydemo.xyz:81/App/SignIn?Email=&quot; + email + &quot;&amp;Password=&quot; + password;
  
                      //string WebAPIUrl = &quot;http://smartentry.visitmydemo.xyz/App/SignIn&quot;;
  
                      //object input = new
                      //{
                      //    Email = email,
                      //    Password = password
                      //};
  
                      //string inputJson = JsonConvert.SerializeObject(input);
  
                      using (HttpClient client = new HttpClient())
                      {
                          
                          Uri uri = new Uri(WebAPIUrl);
                          client.Timeout = TimeSpan.FromMinutes(30);
  
                          string json = await client.GetStringAsync(uri);
                          
                          EntryClass MyEntry = JsonConvert.DeserializeObject&lt;EntryClass&gt;(json);
  
                          if (Convert.ToInt32(MyEntry.UserAccountId) &gt; 0 &amp;&amp; Convert.ToInt32(MyEntry.UserRoleId) &gt; 0 &amp;&amp; (Convert.ToBoolean(MyEntry.IsActive) == true) &amp;&amp; Convert.ToInt32(MyEntry.ClientId) &gt; 0)
                          {
                              //nevigate to dashboard page
                              await App.Current.MainPage.DisplayAlert(&quot;Error&quot;, &quot;Login Success!!&quot;, &quot;OK&quot;);
  
                          }
                          else if (Convert.ToInt32(MyEntry.UserAccountId) == 0 &amp;&amp; Convert.ToInt32(MyEntry.UserRoleId) == 0 &amp;&amp; (Convert.ToBoolean(MyEntry.IsActive) == false) &amp;&amp; Convert.ToInt32(MyEntry.ClientId) == 0)
                          {
                              //if login fails
                              await App.Current.MainPage.DisplayAlert(&quot;Error&quot;, &quot;Invalid Login, try again!!&quot;, &quot;OK&quot;);
                          }
                      }
                  }
                  catch (Exception ex)
                  {
                    await  App.Current.MainPage.DisplayAlert(&quot;Error&quot;, &quot;Error :&quot; + ex.Message.ToString(), &quot;OK&quot;);
  
                  }
              }
              else
              {
                 await App.Current.MainPage.DisplayAlert(&quot;Error&quot;, &quot;All fields are required&quot;, &quot;OK&quot;);
              }
          }
  </code></pre>
  <p>and there is another implement to get access traffic true i just do this things</p>
  <ol>
  <li>adds <code>[assembly: Application(UsesCleartextTraffic = true)]</code> to AssemblyInfo.cs</li>
  <li>create one file res/xml/net_sec_conf.xml as like :</li>
  </ol>
  <blockquote>
  
  <pre><code>&lt;network-security-config&gt;
    &lt;base-config cleartextTrafficPermitted=&quot;false&quot;&gt;
        &lt;trust-anchors&gt;
            &lt;certificates src=&quot;system&quot; /&gt;
        &lt;/trust-anchors&gt;
    &lt;/base-config&gt;
    &lt;domain-config cleartextTrafficPermitted=&quot;true&quot;&gt;
        &lt;domain includeSubdomains=&quot;true&quot;&gt;http://smartentry.visitmydemo.xyz:81/&lt;/domain&gt;
        &lt;trust-anchors&gt;
            &lt;certificates src=&quot;system&quot; /&gt;
        &lt;/trust-anchors&gt;
    &lt;/domain-config&gt;
  &lt;/network-security-config&gt;
  </code></pre>
  </blockquote>
  <ol start="3">
  <li>and finally added this to AndroidManifest.xml in section as like:</li>
  </ol>
  <blockquote>
  <p>&lt;application android:networkSecurityConfig=&quot;@xml/net_sec_conf&quot; ....&gt;</p>
  </blockquote>
  <p>please help me to out of this stucks...</p>