/**/
/// <summary>
/// 相同盘符下,路径2相对于路径1的相对路径
/// </summary>
/// <param name="sFromPath">路径起始点</param>
/// <param name="sToPath">路径终结点</param>
/// <returns>从起点到终点经历的路径</returns>
public static string sfxMakeRelativePath( string sFromPath, string sToPath)
... {
string s1 = sFromPath.Substring(sFromPath.IndexOf(":") + 1).Replace("/", "/");//忽略可能存在的盘符
if (!s1.StartsWith("/")) s1 = "/" + s1;//确保路径以“/”开始,构造符合条件的虚拟路径,使能调用MakeRelative
string s2 = sToPath.Substring(sToPath.IndexOf(":") + 1).Replace("/", "/");
if (!s2.StartsWith("/")) s2 = "/" + s2;
return System.Web.VirtualPathUtility.MakeRelative(s1,s2).Replace("/", "/");
}
/// 相同盘符下,路径2相对于路径1的相对路径
/// </summary>
/// <param name="sFromPath">路径起始点</param>
/// <param name="sToPath">路径终结点</param>
/// <returns>从起点到终点经历的路径</returns>
public static string sfxMakeRelativePath( string sFromPath, string sToPath)
... {
string s1 = sFromPath.Substring(sFromPath.IndexOf(":") + 1).Replace("/", "/");//忽略可能存在的盘符
if (!s1.StartsWith("/")) s1 = "/" + s1;//确保路径以“/”开始,构造符合条件的虚拟路径,使能调用MakeRelative
string s2 = sToPath.Substring(sToPath.IndexOf(":") + 1).Replace("/", "/");
if (!s2.StartsWith("/")) s2 = "/" + s2;
return System.Web.VirtualPathUtility.MakeRelative(s1,s2).Replace("/", "/");
}