Search code examples
asp.netwebactivator

WebActivator - access to the Server object / current directory


I have a WebActivator bootstrapper that needs access to the Server property. Specifically, it needs to know what Server.MapPath("~") is.

Is there a way to do this?


Solution

  • The best way to do this is to just call HttpRuntime.AppDomainAppPath.

    Or if you want to call MapPath on arbitrary paths, use System.Web.Hosting.HostingEnvironment.MapPath("~/some/file.aspx").