The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.
You could try System.Web.Hosting.HostingEnvironment.MapPath().
No HttpContext required.
Use AppDomain.CurrentDomain.BaseDirectory
because Context
might return null !!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With