private static string RetrieveRemoteFile(string file) { file = Utils.AbsoluteWebRoot.ToString() + file.Substring(1); Uri url; if (Uri.TryCreate(file, UriKind.Absolute, out url)) { try { var script = new RemoteFile(url, false).GetFileAsString(); if (BlogSettings.Instance.CompressWebResource) { var min = new JavascriptMinifier(); return(min.Minify(script)); } return(script); } catch (SocketException) { // The remote site is currently down. Try again next time. } } return(string.Empty); }
private static string RetrieveRemoteFile(string file) { file = Utils.AbsoluteWebRoot.ToString() + file.Substring(1); Uri url; if (Uri.TryCreate(file, UriKind.Absolute, out url)) { try { var script = new RemoteFile(url, false).GetFileAsString(); if (BlogSettings.Instance.CompressWebResource) { var min = new JavascriptMinifier(); return min.Minify(script); } return script; } catch (SocketException) { // The remote site is currently down. Try again next time. } } return string.Empty; }