PDA

View Full Version : JAVA-how to access secure webpage w/userid & passwd?


wbing3
07-26-2005, 05:27 PM
Hi Readers,

I am using Java to access a secure webpage (https://etc...) that requires a userid and password. I am using the following Java code:

String urlAddr = "https://webaddress?userid=USERID&password=PASSWORD";
URL url = new URL(urlAddr);
URLConnection con = url.openConnection();
InputStream in = con.getInputStream();
BufferedReader result = new BufferedReader( new InputStreamReader( in ) );

String Info = result.readLine();

The above code gives the following timeout exception:

Exception occurred: Connection timed out: connect Stack Trace:[Ljava.lang.StackTraceElement;@d6c16c

Note: I am behind a firewall that requires authentication (userid and password) before I can gain access to the internet. Therefore, there are two levels of authentication. I am only addressing one above. Can someone please advise to what options are available?
Thanks,
wbing3

tricolaire
07-29-2005, 03:19 AM
write some code to get out of the firewall, manually deactiviate the firewall

both of those would work. try looking at the java.net APIs

one thing I would try first though, is when writing the method, after the arguments, add throws TimeoutException, or whatever the name of the specific exception, and just see what the program does w/ the firewall