a1204773 a1204773 - 1 month ago 30
C# Question

Cannot use Server.MapPath

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

you can try using this

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

or use HostingEnvironment.MapPath

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