Skip to main content

ASP.Net – Server operation is not available in this context – Using Server.MapPath in Global.asax

If you try to use the Server.MapPath() function in your global.asax file for ASP.Net you are likely to encounter this error: Server operation is not available in this context To use Server.MapPath() in global.asax instead use: System.Web.Hosting.HostingEnvironment.MapPath() More details about System.Web.Hosting.HostingEnvironment.MapPath() are available on MSDN

Read More