473,581 Members | 3,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

urlconnection doesn't working with redirect?

hi, I've trying to grab a asp page but it seems java can't handle any page
that is not static (or redirected?)?
I evened tryied using HttpURLConnecti on class and set setFollowRedire cts()
to true, but still I didn't get the html page (that shows up when you open
the site from IE) instead I get a very short page, what's going on?

thanks

------------------- my methods to pull this asp page -----------
URL u = new URL("http://www.yourname.co m");

HttpURLConnecti on url;
url = (HttpURLConnect ion)u.openConne ction() ;
url.setFollowRe directs(true);

BufferedReader html = new BufferedReader( new InputStreamRead er(
url.getInputStr eam()));
from the page I get back there is following javascript

location.replac e("default.asp" );
anyone know what's going wrong? thanks
tony

Jul 17 '05 #1
1 11077
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tony wrote:
hi, I've trying to grab a asp page but it seems java can't handle
any page that is not static (or redirected?)?
I evened tryied using HttpURLConnecti on class and set
setFollowRedire cts() to true, but still I didn't get the html page
(that shows up when you open the site from IE) instead I get a very
short page, what's going on?

thanks from the page I get back there is following javascript

location.replac e("default.asp" );


Hi,
setFollowRedire cts() will cause the connection to follow HTTP
redirects, but it doesn't operate on the content (i.e. doesn't parse
JavaScript). You'll need to do that yourself.

- --
Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+/jvZwxczzJRavJYR AktwAJ9q/tPcMXe0ENwir70G C/sm8VryIgCfZ0S/
GfzT505ihlUP3dS Bg2sHUxM=
=2rCq
-----END PGP SIGNATURE-----
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7196
by: Chewy509 | last post by:
Hi Everyone, I'll just start, and say I am not a PHP developer (I'm a sysadmin, who has gotten lumped with a non-working website). But since I like to do this type of stuff, I though I might just learn WTF is going on? :) Basically, sessions are being created, but no info in being stored in the session, and if data is stored (about 1 in...
4
3935
by: Jochen Daum | last post by:
Hi, I have to emulate a "file upload" to a Java Servlet which is done with the class URLConnection. The java source basically does URLConnection conn = theurl.openConnection("https://somesite"); w = conn.getOutputStream(); w.write(...)
1
9693
by: Johnnie | last post by:
Hello, I am trying to submit a request object to a server (not local), using a servlet. When given a ZIP code this particular server is supposed to return xml with the city/state/areacode etc... The instructions for the server are: :HTTP GET The following is a sample HTTP GET request and response.
0
3946
by: prabhat | last post by:
Hi, The getHeaderField(0) of class URLConnection in java.net package returns a String which provides status code. An example of returned string is : "HTTP/1.0 200 OK". The status code 200 mean success. Does any body know when this method will return a null value? Since I am not getting an IOException, I am sure that connection logic is file...
3
3386
by: mark.irwin | last post by:
Hello all, Have an issue where a redirect pushes data to a page with a select case which then redirects to another page. Problem is the redirect isnt working in 1 case. Code below: strURL = "" if i = 1 then strURL = "redirect.aspx?page=APIQ&parcel=" & strParcel &
12
6563
by: Henry Wu | last post by:
Hi, I've semi-successfully converted my old VB6 project to VB.NET2003 http://wuhenry.beigetower.org/vbVideoInspection.rar ,it is a simple webcam program that works flawlessly on VB6. Now I'm having difficulties with the capGetStatus & capDriverGetCaps function to work, all of the capGetStatus's & capDriverGetCaps' properites ends up zero!...
5
2123
by: ODAN | last post by:
We are testing a ASP.NET application in Visual Studion 2003 and written in C#. One of the pages that register new users on this application fails to redirect to another page when the button is clicked. On the page there is a button that has been code to save to database and also redirect to the login page. When you fill out the form and click...
2
399
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page that gets redirected to, I've swapped in a simple page for testing that reads the session variables and displays their values.
3
2044
by: Athmaus | last post by:
Hello, I have this ecom page that i am making where customers can select to choose additional licenses before they purchase. I have that part working with javascript. Problem is that when the selection is made and you hit the add but it isn't sending to the right pages (and i think i need to do it in another statemen instead of a...
0
7886
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7809
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8183
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.