How do I find the root path of a website from a dll?

Posted by Biff MaGriff on Stack Overflow See other posts from Stack Overflow or by Biff MaGriff
Published on 2010-03-12T04:14:35Z Indexed on 2010/03/12 4:17 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

I have a C# website. It references several compiled dlls. My dlls need to access folders on the website. How do I find the root path of the website from the dlls?

I've 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.

Thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about dll