public static AGSImageService BuildImageServiceFromURL(string Name, string URL) { AGSImageService aGSImageService = null; AGSImageService result; try { string text = AGSConnection.BuildConnectionURL(URL); if (string.IsNullOrEmpty(text)) { result = aGSImageService; } else { AGSConnection aGSConnection = AGSConnection.ReestablishConnection(text, null, ""); if (aGSConnection != null) { try { string name = AGSImageService.BuildFullNameFromURL(URL); if (string.IsNullOrEmpty(Name)) { Name = AGSImageService.BuildNameFromURL(URL); } aGSImageService = new AGSImageService(name, aGSConnection); aGSImageService.Name = Name; if (aGSImageService.IsValid) { result = aGSImageService; return(result); } result = null; return(result); } catch { result = null; return(result); } } result = null; } } catch { result = null; } return(result); }