franzo
franzo

Reputation: 1469

Server.MapPath with virtual directory on .Net Core

How do you do the equivalent of Server.MapPath to find the path of a virtual directory with .Net Core?

Upvotes: 3

Views: 6190

Answers (1)

mvermef
mvermef

Reputation: 3924

Path.Combine(Env.WebRootPath, "SomePath") is the equivalent..

Env.WebRootPath where Env = environment, usually from the startup.cs

edit

what about this...

ApplicationEnvironment env = new ApplicationEnvironment(); env.ApplicationBasePath;

there is a big thread about this on the asp.net core mvc on GitHub not sure if this is what you are looking for or not.

Upvotes: 1

Related Questions