Search code examples
asp.nethttpiishttpcontext

Get application path without using httpcontext. (asp.net)


How to do it?

I don't want to use this:

HttpContext.Current.Server.MapPath

Is there a similar function that I can call without requiring a httpcontext?

For example if a start a thread doing some stuff i cant use the httpcontext, but i still need to get the path of the app. And no i can't pass the context as an argument or read it from a shared var.


Solution

  • Use the HttpRuntime.AppDomainAppPath property.