Cannot use Server.MapPath

a1204773 picture a1204773 · Jun 19, 2012 · Viewed 229.7k times · Source

What I must do to make Server.MapPath work?
I have using System.Web;

what else? When I type Server there is no quick result option (intelli-sense) for Server.

Any help?

Answer

DotNetUser picture DotNetUser · Jun 19, 2012

you can try using this

    System.Web.HttpContext.Current.Server.MapPath(path);

or use HostingEnvironment.MapPath

    System.Web.Hosting.HostingEnvironment.MapPath(path);