Automate authentication of a web-site through HTTPUrlConnection
- From: rajivranjan09@xxxxxxxxx
- Date: 27 Feb 2006 00:10:33 -0800
Hi Guys,
I have a website which uses SSL communication. When someone tries to
access this site, it pops up a HTTP authentication box and only on
successfull authentication can a client access the site.
I am trying to write a utility whcih can try to access this site once a
day. I am using HTTPUrlConnection for this but I have no idea how would
the utility provide credentials information to the application. I
tried doing this -
URL mySite = new URL(mySiteURL);
HttpURLConnection mySiteConn =
(HttpURLConnection)mySite.openConnection();
mySiteConn.setRequestProperty("Authentication", "rajiv:welcome");
mySiteConn.setRequestMethod("GET");
int httpStatusCode = mySiteConn.getResponseCode();
but "mySiteConn.getResponseCode()" is throwing IOException.
Can someone please tell me how can I possibly do this?
_Rajiv
.
- Follow-Ups:
- Re: Automate authentication of a web-site through HTTPUrlConnection
- From: William Brogden
- Re: Automate authentication of a web-site through HTTPUrlConnection
- Prev by Date: Re: Please help: Exception in thread "Thread-3" java.lang.NullPointerException
- Next by Date: Re: Please help: Exception in thread "Thread-3" java.lang.NullPointerException
- Previous by thread: Java application write to http online
- Next by thread: Re: Automate authentication of a web-site through HTTPUrlConnection
- Index(es):