How does Basic Authentication work?

D

dan

URLConnection connection = url.openConnection();

connection.setRequestProperty("Proxy-Authorization", "Basic
"+"c2VydmljZTAxAdswMQ==");

connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible;
MSIE 5.5; Windows NT 5.0)");
connection.setRequestProperty("Accept", "text/html, image/*");
connection.setDoInput( true );
connection.setDoOutput( true );
connection.setUseCaches( false );

connection.connect();



So this is my code...
Proxy-Authorization does work! How can I logon to another site via
Basic Authentication?
 
C

Chris Smith

dan said:
URLConnection connection = url.openConnection();

connection.setRequestProperty("Proxy-Authorization", "Basic
"+"c2VydmljZTAxAdswMQ==");

connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible;
MSIE 5.5; Windows NT 5.0)");
connection.setRequestProperty("Accept", "text/html, image/*");
connection.setDoInput( true );
connection.setDoOutput( true );
connection.setUseCaches( false );

connection.connect();



So this is my code...
Proxy-Authorization does work! How can I logon to another site via
Basic Authentication?

Umm, set an Authorization header, I guess. It looks exactly like your
Proxy-Authorization header, so you've already got the code to build it,
right?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top