//本地路徑轉換成URL相對路徑
private string urlconvertor(string imagesurl1)
{
string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//獲取程序根目錄
string imagesurl2 = imagesurl1.Replace(tmpRootDir, ""); //轉換成相對路徑
imagesurl2 = imagesurl2.Replace(@"\", @"/");
//imagesurl2 = imagesurl2.Replace(@"Aspx_Uc/", @"");
return imagesurl2;
}
//相對路徑轉換成服務器本地物理路徑
private string urlconvertorlocal(string imagesurl1)
{
string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//獲取程序根目錄
string imagesurl2 = tmpRootDir + imagesurl1.Replace(@"/", @"\"); //轉換成絕對路徑
return imagesurl2;
}