// code to add to a URLConnection GET request // to add basic userid/password authentication. // For JDK 1.1- where Authenticator is not available. import com.mindprod.base64.Base64; import java.net.URL; import java.net.URLConnection; //... String userid = "Alladin"; String password = "sesame"; String stringUserIdPassword = userid + ":" + password; byte[] byteUserIdPassword = stringUserIdPassword.getBytes( "ASCII" ); String base64UserIdPassword = new Base64().encode( byteUserIdPassword ); urlc.setRequestProperty( "Authorization", "Basic " + base64UserIdPassword ); urlc.connect();