在 .aspx.cs 可以使用 Server.MapPath() or Request.MapPath() 來取伺服器的實體路徑,不過在Class檔中是沒有這兩個玩意的

 所以就用 HttpContext.Current.Server.MapPath("/MyWeb") 來抓路徑,引號內為 IIS 資料夾位置,若只有 "/" 則取根目錄

 

參考:http://www.dotblogs.com.tw/jjwei/archive/2010/10/07/18185.aspx

arrow
arrow
    全站熱搜

    Empty 發表在 痞客邦 留言(0) 人氣()