Using Server.MapPath() inside a static field in ASP.NET MVC

前端 未结 2 1649
小鲜肉
小鲜肉 2020-12-13 02:59

I\'m building an ASP.NET MVC site where I\'m using Lucene.Net for search queries. I asked a question here about how to properly structure Lucene.Net usage in an ASP.NET MVC

2条回答
  •  佛祖请我去吃肉
    2020-12-13 03:58

    Try HostingEnvironment.MapPath, which is static.

    See this SO question for confirmation that HostingEnvironment.MapPath returns the same value as Server.MapPath: What is the difference between Server.MapPath and HostingEnvironment.MapPath?

提交回复
热议问题