Server.MapPath when HttpContext is null
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
To work around this problem you can use the method:
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()

No comments:
Post a Comment