C# Server.MapPath的使用方法

(1)WebForm中:

  HttpContext.Current.Server.MapPath("~/Files/car/");

(2)Mvc中:

  Server.MapPath()

(3)最底层的写法:

  String path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
             path = string.Format(@"{0}Data\Log\{1}\", path, DateTime.Now.ToString("yyyy-MM-dd"));//按时间格式保存日志文件

猜你喜欢

转载自www.cnblogs.com/Kendy/p/10477207.html
今日推荐