AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automate authentication of a web-site through HTTPUrlConnect

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Feb 27, 2006 8:12 am    Post subject: Automate authentication of a web-site through HTTPUrlConnect Reply with quote



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
Back to top
William Brogden
Guest





PostPosted: Mon Feb 27, 2006 4:12 pm    Post subject: Re: Automate authentication of a web-site through HTTPUrlCon Reply with quote



On 27 Feb 2006 00:10:33 -0800, <rajivranjan09 (AT) gmail (DOT) com> wrote:

Quote:
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


You might want to look into the HttpClient toolkit

http://jakarta.apache.org/commons/httpclient/sslguide.html


--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.