Server.MapPath()

后端 未结 3 447
予麋鹿
予麋鹿 2021-01-19 00:56

I want to use Server.MapPath() method im order to map a virtual directory I created to its physical path.

The thing is that the .net environment doesn\'t recognize S

3条回答
  •  花落未央
    2021-01-19 01:52

    If you have a web application, you should automatically have a reference to System.Web.dll, and you should have access to the System.Web.HttpContext class. Check that you haven't accidentally removed the reference. You would need a using System.Web; statement to access the HttpContext class without specifying the complete namespace.

    If you don't have a web application you would have to add a referece to System.Web.dll to get access to the HttpContext class, but that would not help you a bit. As you are not in a web application, there is no HTTP context and there is no web root folder, so you can not use the MapPath method.

提交回复
热议问题