URL connection through a proxy-based firewall

S

Sharp

Hi

I am trying to make a URL connection to a particular website through a
proxy-based firewall. But I am recieving a HTTP reponse code 407, which
suggest that I have an authenication problem. I have checked that my proxy
name, port, username and password is correct.

Code snippet
.....
System.setProperty("proxySet", "true");
System.setProperty("http.proxyHost", "XXX");
System.setProperty("http.proxyPort", "XXX");
System.setProperty("http.proxyUser", "XXX");
System.setProperty("http.proxyPassword", "XXX");

URL url = new URL ("http://www.hotmail.com");
URLConnection connection = connection = url.openConnection();

also tried

System.setProperty("proxySet", "true");
System.setProperty("http.proxyHost", "XXX");
System.setProperty("http.proxyPort", "XXX");

URL url = new URL ("http://www.hotmail.com");
URLConnection connection = url.openConnection();
String encodedPassword = Base64Coder.encode("username:password");
connection.setRequestProperty("Proxy-Authorization", encodedPassword);


Any help appreciated.


Regards
Sharp
 
S

steph

I use this piece of code:

// sets system properties
setSystemProperty("http.agent", prop);
setSystemProperty("http.proxyHost", prop);
setSystemProperty("http.proxyPort", prop);
setSystemProperty("http.nonProxyHosts", prop);

Authenticator.setDefault(
new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return (new PasswordAuthentication(user, pass.toCharArray()));
}
}
);


Le 11/10/2004 09:36, Sharp a écrit :
 
S

Sharp

Thanks.

Fingers-crossed :)

Regards
Sharp

I use this piece of code:

// sets system properties
setSystemProperty("http.agent", prop);
setSystemProperty("http.proxyHost", prop);
setSystemProperty("http.proxyPort", prop);
setSystemProperty("http.nonProxyHosts", prop);

Authenticator.setDefault(
new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return (new PasswordAuthentication(user, pass.toCharArray()));
}
}
);


Le 11/10/2004 09:36, Sharp a écrit :
 
A

Alex Hunsley

Sharp said:
Hi

I am trying to make a URL connection to a particular website through a
proxy-based firewall. But I am recieving a HTTP reponse code 407, which
suggest that I have an authenication problem. I have checked that my proxy
name, port, username and password is correct.

Stop posting the same thing over and over again! It won't make anyone
answer any quicker, if anything, people will killfile you and ignore you.
Be aware that posts to usenet take time to appear.
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top