title: Calling Asp.net web API from Android Studio View
body: <p>I have a problem while accessing asp.net web API through android studio project. My web API connect with the database through Entity Framework. I want to call the list of Merchants through API Merchant Controller from android merchant view. Here is my HttpGet method for Merchant: </p>
  
  <pre><code>public class MerchantController : ApiController
      {
          private DostiCardDBEntities merchantEntities = new DostiCardDBEntities();
  
          [HttpGet]
          public HttpResponseMessage listOfMerchant() {
              return Request.CreateResponse(HttpStatusCode.OK, merchantEntities.MerchantTables.ToList());
          }
  }
  </code></pre>
  
  <p>I access list of Merchants through AsyncTask doInBackground method i-e </p>
  
  <pre><code>private class ExecuteTask extends AsyncTask&lt;String, Integer, String&gt;{
          String jsonText = "";
          HttpsURLConnection connection;
          @Override
          protected String doInBackground(String... strings) {
              try {
                  URL url = new URL("http://169.254.80.80:6040/api/Merchant");
                  connection = (HttpsURLConnection) url.openConnection();
                  connection.setRequestMethod("GET");
                  connection.connect();
                  InputStream inputStream = connection.getInputStream();
  
                  int byteCharacter;
  
                  while ((byteCharacter = inputStream.read()) != -1){
                      char c = (char) byteCharacter;
                      jsonText += c;
                  }
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
              finally {
                  connection.disconnect();
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(String s) {
              Toast.makeText(getApplicationContext(), jsonText, Toast.LENGTH_LONG).show();
          }
      }
  </code></pre>