0

I'm trying to use

Server.MapPath

In my file location, which has worked perfectly so far in my project, however now I have ceated a new class inside the App_Code folder in my site and I can no longer use "Server" ,I get the error

"Error 4 The name 'Server' does not exist in the current context"

How can I fix this? I would like to be able to use Server.MapPath instead of alternatives as I have already done this for the rest of the site, so is there anyway? If not what are my alternatives?

I also tried

~\\App_Code\\myfile

But this didn't work either. Thanks!

1 Answers1

4

Just use the full namespace:

HttpContext.Current.Server.MapPath(...);
DavidG
  • 113,891
  • 12
  • 217
  • 223