I can't use Server.MapPath in c# class libary?

422 Views Asked by At

I need to access the folder in ~/Templates in my application. I didn't get the suggestion for server.MapPath. Why so?

Also, I tried using the HostingEnvironment.MapPath and System.Web.HttpContext.Current.Server.MapPath.But it returns null. Is there any solution for this?

var path = System.Web.HttpContext.Current.Server.MapPath("~/Templates");
0

There are 0 best solutions below