27 lines
714 B
C#
27 lines
714 B
C#
namespace YLErp.Helpers
|
|
{
|
|
/// <summary>
|
|
/// 文档路径转换
|
|
/// </summary>
|
|
public static class DocumentPathConvert
|
|
{
|
|
/// <summary>
|
|
/// 将物理路径转换为URL路径
|
|
/// </summary>
|
|
public static string ConvertToUrlPath(string physicalPath)
|
|
{
|
|
if (string.IsNullOrEmpty(physicalPath))
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
var index = physicalPath.IndexOf("\\App_Docs\\", StringComparison.OrdinalIgnoreCase);
|
|
if (index > 0)
|
|
{
|
|
physicalPath = physicalPath.Substring(index);
|
|
}
|
|
return physicalPath.Replace("\\", "/");
|
|
}
|
|
}
|
|
}
|