diff --git a/src/Microsoft.AspNet.Hosting.Interfaces/HostingEnvironmentExtensions.cs b/src/Microsoft.AspNet.Hosting.Interfaces/HostingEnvironmentExtensions.cs
index b39316a281..0af82fee14 100644
--- a/src/Microsoft.AspNet.Hosting.Interfaces/HostingEnvironmentExtensions.cs
+++ b/src/Microsoft.AspNet.Hosting.Interfaces/HostingEnvironmentExtensions.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.IO;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Hosting
@@ -23,5 +24,23 @@ namespace Microsoft.AspNet.Hosting
environmentName,
StringComparison.OrdinalIgnoreCase);
}
+
+ ///
+ /// Gives the physical path corresponding to the given virtual path.
+ ///
+ /// An instance of service.
+ /// Path relative to the root.
+ /// Physical path corresponding to virtual path.
+ public static string MapPath(
+ [NotNull]this IHostingEnvironment hostingEnvironment,
+ string virtualPath)
+ {
+ if (virtualPath == null)
+ {
+ return hostingEnvironment.WebRootPath;
+ }
+
+ return Path.Combine(hostingEnvironment.WebRootPath, virtualPath);
+ }
}
}
\ No newline at end of file