When I have written following piece of code to check whether the site is up or not I always get http 503, even though the site is working fine when I hit it on browser.
URL url=getASCIIUrl(httpUrl);
HttpURLConnection con = null;
con = (HttpURLConnection) url.openConnection();
HttpURLConnection.setFollowRedirects(false);
con.setRequestMethod("GET");
con.setConnectTimeout(CONNECTION_TIMEOUT);
con.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.01; WiPOSTndows NT 5.0)");
int code = con.getResponseCode();
Everytime I get Http 503 in responsecode. Can anyone suggest a way to overcome this problem?