.net – Server.MapPath()

netserver.mappath

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 Server.MapPath().

Google told me I'm supposed to use HttpContext.Current.Server using System.Web,
but HttpContext isn't recognized in spite of me using System.Web. (And I've checked –
HttpContext IS one of System.Web's classes)

Help?

Best Answer

Make sure you have included System.Web in your projects References Do these (In Visual Studio IDE):

  1. Right click on the Project Node (Solution Explorer Window)
  2. On the context mennu, click Add Reference
  3. Select System.Web on the .NET Tab list items.
  4. Hit OK button

Server.MapPath should now be available.