Server.MapPath() in non Page class

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a class that I need to use Server.MapPath(), when I try to compile, I
get this error:
The type or namespace name 'Server' could not be found (are you missing a
using directive or an assembly reference?)

Are there any static members I can access outside the Page class to get to
MapPath?
 
Assuming your class is operating in the context of an HttpRequest for an
ASPX page, refer to HttpContext.Current.Server.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.
 
Back
Top