How do I get the current directory in a web service

前端 未结 7 810
情歌与酒
情歌与酒 2020-12-09 08:04

I am using System.IO.Directory.GetCurrentDirectory() to get the current directory in my web service, but that does not give me the current directory. How do I get the curren

相关标签:
7条回答
  • 2020-12-09 08:42

    HttpContext.Current.Server.MapPath("~/") would get you the root of the application?

    Which is plenty most likely as you probably know the path from there.

    Another option which might be of interest:

    HttpContext.Current.Server.MapPath("/Directory/") 
    

    This builds from the root of the application no matter what.

    Without the first slash this will take directory from where you call as the start:

    HttpContext.Current.Server.MapPath("Directory/") 
    
    0 讨论(0)
提交回复
热议问题