Cannot use Server.MapPath

前端 未结 8 1428
悲哀的现实
悲哀的现实 2020-12-02 10:11

What I must do to make Server.MapPath work?
I have using System.Web;

what else? When I type Server there is no quick resu

8条回答
  •  無奈伤痛
    2020-12-02 11:05

    System.Web.HttpContext.Current.Server.MapPath("~/") gives null if we call it from a thread.

    So, Try to use

    System.Web.Hosting.HostingEnvironment.MapPath("~/")

提交回复
热议问题