資料來源:
利用Server.mapPath()取得網站相關路徑(HttpContext.Current.Server.MapPath,路徑,根目錄,目前應用程式,上一層,類別,vb,HttpContext.Current.Server.MapPath))
'假設目前程式路徑:c:\Inetpub\wwwroot\myApp\subDir\subDir2\abc.aspx
'取得目前應用程式路徑,ex:c:\Inetpub\wwwroot\myApp\
Dim aaa As String = Server.MapPath("~\")
'取得目前應用程式路徑,ex:c:\Inetpub\wwwroot\myApp\
Dim bbb As String = Server.MapPath("~/")
'取得目前應用程式路徑,ex:c:\Inetpub\wwwroot\myApp\
Dim fff As String = Server.MapPath("~")
'取得根目錄路徑,ex:c:\Inetpub\wwwroot\
Dim ccc As String = Server.MapPath("/")
'取得目前頁面路徑,ex:c:\Inetpub\wwwroot\myApp\subDir\subDir2\
Dim ddd As String = Server.MapPath("./")
'取得目前頁面上一層路徑,ex:c:\Inetpub\wwwroot\myApp\subDir\
Dim eee As String = Server.MapPath("../")
'取得目前頁面上上一層路徑,ex:c:\Inetpub\wwwroot\myApp\
Dim hhh As String = Server.MapPath("../../")
沒有留言:
張貼留言