Application.StartupPath // 擷取啟動了應用程式的可執行檔的路徑,不包括可執行檔的名稱。
Application.ExecutablePath // 擷取啟動了應用程式的可執行檔的路徑,包括可執行檔的名稱。
AppDomain.CurrentDomain.BaseDirectory // 擷取基目錄,它由程式集衝突解決程式用來探測程式集。--啟動應用程式的目錄
Thread.GetDomain().BaseDirectory // 擷取基目錄,它由程式集衝突解決程式用來探測程式集。 --啟動應用程式的目錄
Environment.CurrentDirectory // 擷取或設定當前工作目錄的完全限定路徑。 --如果activex則為案頭的路徑,其他則為DLL所在目錄
Directory.GetCurrentDirectory() // 擷取應用程式的當前工作目錄。 --如果activex則為案頭的路徑,其他則為DLL所在目錄
Assembly.GetExecutingAssembly().Location //
擷取包含清單的已負載檔案的路徑或 UNC 位置。--當前DLL所在目錄,如果在activex中擷取當前控制項的安裝路徑,就用這個
通過Request屬性擷取:
// 擷取當前正在執行的伺服器應用程式的根目錄的物理檔案系統路徑。
Request.PhysicalApplicationPath; // E:\解決方案\項目\//
擷取與請求的 URL 相對應的物理檔案系統路徑。
Request.PhysicalPath; // E:\\解決方案\項目\zz\zz.aspx
擷取虛擬路徑和URL資訊:(URL:http://localhost/aspnet/zz/zz.aspx/info?name=wk )
// 擷取伺服器上 ASP.NET 應用程式的虛擬應用程式根路徑:/
Request.ApplicationPath;// /aspnet //
擷取應用程式根的虛擬路徑,並通過對應用程式根使用波狀符號 (~) 標記法使該路徑成為相對路徑。
Request.AppRelativeCurrentExecutionFilePath; // ~/zz/zz.aspx //
擷取當前請求的虛擬路徑
Request.CurrentExecutionFilePath;// /aspnet/zz/zz.aspxRequest.FilePath;//
/aspnet/zz/zz.aspx
// 擷取CurrentExecutionFilePath屬性中指定的檔案名稱的副檔名。
Request.CurrentExecutionFilePathExtension; // .aspx
// 擷取當前請求的虛擬路徑(包括附件路徑資訊)
Request.Path;// /aspnet/zz/zz.aspx/info
// 擷取具有 URL 副檔名的資源的附加路徑資訊。
Request.PathInfo; // /info
// 擷取有關當前請求的 URL 的資訊。
Request.Url;//http://localhost/aspnet/zz/zz.aspx/inf?name=wk
// 擷取當前請求的原始
URLRequest.RawUrl; // /aspnet/zz/zz.aspx/inf?name=wk
// 擷取有關用戶端上次請求的 URL 的資訊,該請求連結到當前的 URL。
Request.UrlReferrer;// System.Uri
轉載:http://hi.baidu.com/happyxuu/item/7669ca87ee6b6addef083d8e