public static string Path2Url(string path, string serverName = "localhost") { // serverName localhost, hata, 192.168.1.53 //ローカルファイルのパスを表すURI //string uriPath = "file:///c:/temp/doc.txt"; string result = String.Empty; if (Lib.IsWebSite(path)) { return(path); } try { result = "file:///" + path.Replace(@"\", "/").ToLower(); result = result.Replace("file:///c:/apache2.2/htdocs", "http://" + serverName); result = result.Replace("file:///f:/", "http://" + serverName + "/f/"); result = result.Replace("file:///c:/eclipse461/xampp/htdocs", "http://" + serverName + ":8081"); } catch (Exception ex) { ex.Message.ToString(); result = string.Empty; } return(result); }
public static bool IsBrowsable(string path) { string extension = Path.GetExtension(path.ToLower()); return(Lib.IsWebSite(path) || (extension == ".php" || extension == ".html" || extension == ".htm")); }