Trang

28 thg 11, 2008

Authenticate to a Proxy Server

To provide a user's password to a proxy server, use the following code:

URLConnection URLcon=null;
URLcon = url.openConnection();
byte[] x="name:password".getBytes();
//coding in Base64
String s = new sun.misc.BASE64Encoder().encode(x);
URLcon.setRequestProperty( "Proxy-Authorization",s);
Leonard Anghel

Không có nhận xét nào:

Đăng nhận xét