前一段時間寫**時經常遇到獲取路徑問題
,總是感覺有點亂
,於是就總結了下,
1.在.net
中web
開發時(1)~/在
runat=server
的控制項中會自動被解析為的值,
是當前應用程式的目錄如
~/usercommunity/index.aspx
則對應為
/henu.rcenter.internal/usercommunity
(2)./
表示當前目錄
(3)../
表示上一層目錄
如usercommunity
資料夾下的檔案中可以以:
../module/
來訪問module
中的檔案
2 獲取當前請求頁面的路徑:
request.filepath
3 獲取專案下的檔案路徑:
資料夾+檔案
如獲取專案下的
temp
資料夾下檔案的路徑
可以用:
string
用法:
若在專案下
content
資料夾下的
userinfomanager.aspx
**中寫如下路徑
this
則返回d:\wxm\
練習\content\uploadresourceimage
C 中獲取路徑的幾種方法
1.在.net中web開發時 usercommunity index.aspx則對應為 henu.rcenter.internal usercommunity 2 表示當前目錄 3 表示上一層目錄 如usercommunity資料夾下的檔案中可以以 module 來訪問module中的檔案 2 獲取...
c 獲取路徑的幾種方法
1 取得控制台應用程式的根目錄方法 2 取得web應用程式的根目錄方法 3 取得winform應用程式的根目錄方法 以上是從網上隨便找別人的總結的,下面是自己工作中遇到的問題,自己做了個控制台程式,然後用任務計畫程式定時執行,執行的時候發現生成的路徑和直接執行控制台生成的檔案路徑不一致!最開始用的s...
C 獲取檔案路徑的幾種方法
string str1 process.getcurrentprocess mainmodule.filename 獲得當前執行的exe的檔名。string str2 environment.currentdirectory 獲取和設定當前目錄的完全限定路徑。string str3 director...