public IActionResult OnGetValidUrl(string baseUrl) { Urls url = new Urls(baseUrl); if (string.IsNullOrEmpty(baseUrl)) { var result = new ServiceDirectory.Common.Results.ValidationResult() { Error = "Please enter the URL for the service directory" }; return(new JsonResult(result)); } if (!url.UrlAbsolute() || !url.UrlValid()) { var result = new ServiceDirectory.Common.Results.ValidationResult() { Error = "Please ensure you specify a valid URL for the service directory." }; return(new JsonResult(result)); } return(new JsonResult(true)); }
public async System.Threading.Tasks.Task <JsonResult> OnGetValidateAsync(string baseUrl, string id) { ServiceDirectory.Common.Results.ValidationResult result = await APIValidator.Validate(baseUrl, id, new APIValidatorSettings() { SamplePages = true }); if (result.GetException() != null) { _logger.LogError(result.GetException(), result.Error); } return(new JsonResult(result)); }