How to find website root path from dll?

I have a C # site. It refers to several compiled libraries. My dlls must access the folders on the website. How to find website root path from dll?

I tried

System.Environment.CurrentDirectory → "C: \ Program Files \ Microsoft Visual Studio 9.0 \ Common7 \ IDE"

Assembly.GetExecutingAssembly (). Location → C: \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files ......

I was going to use

System.Web.HttpContext.Current.Server.MapPath ()

but System.Web.HttpContext.Current is null.

Thank!

+3
source share
1 answer

HttpRuntime.AppDomainAppPath, ASP.NET AppDomain.

+8

Source: https://habr.com/ru/post/1736600/


All Articles