Hi, 
I am having problems to make authentication with Microsoft Proxy
server because it requires a domain to authentication. 

I wrote the following program of test to try the authentication
because I did not obtain access servlets. I only receive code 407, of
required authentication. I would like know if somebody can help to
decide this problem, mainly when is necessary a domain to carry
through the authentication. Thanks in advance 

import java.net.*; 
import java.io.*; 

public class TesteProxyAuth 
{ 
public static void main(String[] args) 
{ 
try 
{ 
System.setProperty("http.proxySet", "true"); 
System.setProperty("http.proxyType", "4"); 
System.setProperty("http.proxyHost", "my_proxy_ip"); 
System.setProperty("http.proxyPort", "my_proxy_port"); 

URL myURL = new URL("http://www.altavista.com"); 
HttpURLConnection connection = (HttpURLConnection)
myURL.openConnection(); 
String password = "my_domain\\my_user:my_password";
String encodedPassword = URLEncoder.encode( password ); 
String auth = "Basic " + new sun.misc.BASE64Encoder ().encode
(password.getBytes()); 
connection.setRequestProperty( "Proxy-Authorization", auth); 
connection.connect(); 
System.out.println("Response Code = 
"+connection.getResponseCode()); 
System.out.println("foi"); 
} 
catch(Exception e) 
{ 
e.printStackTrace(); 
} 
} 
} 


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to