Monday, August 31, 2015

ASP.NET MVC HttpContext.Current.Server.MapPath null for WCF Webservice


Just solved a problem at work:

If HttpContext.Current.Server.MapPath is giving you null or an exception or not working, there are several possibilities. One of them is you didn't enable compatibility mode.

Better off to migrate to another way of finding the server path than depending on HttpContext though,

HttpContext is bad to depend on, when dealing with WCF or non-MVC applications (there isn't always a context.)

Hope this helps someone

~ B


  1. this is an important article to read for all the programmers, i think. because it enlists all the points and importance of being a programmar. keep at it, and dont stop posting more

  2. Expand Business Internationally with Business Mergers or Business Contract

  3. Avlite Systems has an industry-leading portfolio of rugged, reliable and patented Aviation lighting products for Aviation, Helipads, Runway, obstruction and Airports lighting