I've been writing some code that is fired from a scheduled task and need to access the root of a website. The usual method of Server.MapPath() returns an error as the HttpContext is null due to running under another thread.
To work around this problem you can use the method: System.Web.Hosting.HostingEnvironment.MapPath()
1 comment:
Went from
Server.MapPath(....)
to
HttpContext.Server.MapPath(...)
to
your solution.
Success! Thanks!
Post a Comment