Wednesday, April 10, 2013

How To Access Server.MapPath in a Class that is not inside Web Project

In My case I have decoupled WCF Class Libraries and WCF Host in to two separate projects.  Then i need to get the Server.MapPath in a class library.

So

I have add the Reference to System.web 

Since I'm using 4.5 dll is available on
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll

HttpContext.Current.Server.MapPath("~/App_Data/MediaPackager_MP4ToSmooth.xml")

Post a Comment