I would like to write a helper function which build the exception message to write to a log. The code look like:
if(IsWebApp) { &
Use the HttpRuntime class:
if (!String.IsNullOrEmpty(HttpRuntime.AppDomainAppVirtualPath)) //ASP.Net else //Non-ASP.Net