How can I use Server.MapPath() from global.asax?

引用:

using System.Web.Hosting;

 

            string filePathcsv = "";
            string file = "";
            string strFile = "LukfookGeovindu";
            strFile = strFile + DateTime.Now.ToString("yyyyMMddhhmmss");
            strFile = strFile + ".csv";
            //file = strFile;  teresaliu@lukfook.com.hk
            //file = HttpContext.Current.Server.MapPath("/ReportExcel/" + strFile); //此用法存在問題
            // Server.MapPath("/ReportExcel/" + strFile);//存在問題
            file = HostingEnvironment.MapPath("/ReportExcel/" + strFile);

 

posted @ 2013-12-03 17:34  ®Geovin Du Dream Park™  阅读(384)  评论(0编辑  收藏  举报