Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8188017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:45:41+00:00 2026-06-07T02:45:41+00:00

So here is the problem I’m having currently…I have a ASPX script that runs

  • 0

So here is the problem I’m having currently…I have a ASPX script that runs on a server (let’s say http://www.myserver.com/script.aspx)…when I open up this page via my web browser I get a plain text page with some data formated like this (just one line):

Data1|Data2|Data3|...

Now I need to fetch this data in my Android app which I did like this:

URL url = new URL("http://www.myserver.com/script.aspx");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader((InputStream) urlConnection.getInputStream()));

String data = in.readLine();
System.out.println(data); // Just to print the result in LogCat for debug

urlConnection.disconnect();

The problem is that the resulting string only contains the letter ‘@’. No sign of my data. I have tried using other web page adresses (like google.com) to test if it’s a problem in my code…but it works…I allways get the first line of the page (usually the first html tag, since it’s a HTML web page).

I am guessing now that this is some kind of problem with the way I’m calling my ASPX script…how can I call it via Java so I get the same result as the browser (eg. the one line with my data)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:45:43+00:00Added an answer on June 7, 2026 at 2:45 am

    Figured it out…I needed to set the user agent to a browser. So doing

    urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
    

    did the trick. The only thing I am wondering now is what user-agent would be ideal to say “I am a browser”…this seems kinda long?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem here with the php function substr Let's say I have
I have a problem here. My Zend_Forms do not render in view script. Via
Here's my problem, say, for example, I have a link on my page, it
Unusual problem here: I have an app that uses a text file which contains
I am having problem here with bitmaps..I want to remove the black background that
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
Super weird problem here. I'm having trouble getting jQuery to bind any selectors except
I have a problem here im trying to upload a file first time it
Im having a problem here. i downloaded jake wharton. He gave an example of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.