title: Can't connect to local area server with asp.net page on Android
body: <p>I'm new here and I wish I won't make any bloomer :)</p>
  
  <p>I'm developing some android app and have stucked in connecting to other computer, where I've installed ASP.net page. I can't emulate it due to problems with connecting to host.</p>
  
  <p>The code that I'm using:</p>
  
  <pre><code>public class SPCChartViewerActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      String strData = urlData("http://[server]/SPCOnline/SQLQuery.aspx?query=SELECT%20NAME%20FROM%20SPC_CHARTS");
      TextView tv = (TextView) findViewById(R.id.textView1);
      tv.setText(strData);
  }
  
  private String urlData(String urlString){
      URLConnection urlConnection = null;
      URL url = null;
      String string = null;
  
      try {
          url = new URL(urlString);
          urlConnection = url.openConnection();
  
          InputStream inputStream = urlConnection.getInputStream();
          InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
          BufferedReader reader = new BufferedReader(inputStreamReader);
          StringBuffer stringBuffer = new StringBuffer();
          while((string = reader.readLine()) != null){
              stringBuffer.append(string + "\n");
          }
          inputStream.close(); 
          string = stringBuffer.toString();
      } 
      catch (MalformedURLException e) {
          e.printStackTrace();
      } 
      catch (IOException e) {
          e.printStackTrace();
      }
      return string;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>In tag [server] I've put:</p>
  
  <ul>
  <li><p>that computer's name: <code>http://miltstx155srv01/SPCOnline/SQLQuery.aspx?query=SELECT%20NAME%20FROM%20SPC_CHARTS</code>
  In this case I receive java.net:UnknownHostException</p></li>
  <li><p>that computer's IP: <code>http://10.72.152.163/SPCOnline/SQLQuery.aspx?query=SELECT%20NAME%20FROM%20SPC_CHARTS</code>
  In this case I receive java.net:FileNotFoundException</p></li>
  <li><p>If I ommit the "http://" I receive java.net:Protocol Not Found</p></li>
  </ul>
  
  <p>Ok, maybe something with my company's DNS. So I've put this page on my computer, which is also running AVD emulator. So the url is now: <code>http://10.0.2.2/SPCOnline/SQLQuery.aspx?query=SELECT%20NAME%20FROM%20SPC_CHARTS</code> - but still java.net:UnknownHostException.</p>
  
  <p>Of course clause <strong>uses-permission android:name="android.permission.INTERNET"</strong> is added to manifest.</p>
  
  <p>Still, every example written upper works fine with webbrowser (of course except 10.0.2.2 - but changing it to localhost makes it work).</p>
  
  <p>No idea, I've spent whole day testing it. Can anyone help?</p>