Connecting to a url with Domain, username and password
I am trying to access a URL(ASPX page on IIS) from Java (Weblogic). I am getting the following url.
java.io.FileNotFoundException: Response: '401: Unauthorized' for url
Any suggestions on how to make a call with domain name?
Here is my code;
String auth = domain + "\\" + userName ":" + password;
String encodedAuth = new BASE64Encoder().encode(auth.getBytes());
URL url = new URL(serviceURL);
URLConnection yc = url.openConnection();
yc.setRequestProperty ("Authorization", "Basic " + encodedAuth);
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));