I would like to write a helper function which build the exception message to write to a log. The code look like:
if(IsWebApp) { &
How about
If (Not System.Web.HttpContext.Current Is Nothing) Then End If
or
if(System.Web.HttpContext.Current != null){ }