How can I use Server.MapPath() from global.asax?
Solution 1:
You could try System.Web.Hosting.HostingEnvironment.MapPath().
No HttpContext required.
Solution 2:
Use AppDomain.CurrentDomain.BaseDirectory
because Context
might return null !!
Solution 3:
When in Global.asax, use the context object:
context.Server.mappath()
Context lets you access also the session collection, the request object, the response object. Very useful when you want to log errors, for example