Server.MapPath does not exist in current context

后端 未结 2 993
挽巷
挽巷 2020-12-29 06:39

Inside my MVC4 project I have the namespace

prj.MVC4.Controllers

where I\'m using Server.MapPath(..) without probl

2条回答
  •  佛祖请我去吃肉
    2020-12-29 07:21

    Server is a property of the controller, to access it elsewhere while running a web application you can use

    System.Web.HttpContext.Current.Server
    

提交回复
热议问题