Server.MapPath does not exist in current context

后端 未结 2 985
挽巷
挽巷 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
    
    0 讨论(0)
  • 2020-12-29 07:25

    Server property is accessible from within controller. You can also find it in HttpContext.Current provided that your app is executed inside asp.net environment.

    0 讨论(0)
提交回复
热议问题