There is no need for checking HttpContext.Current != null as we're not using it, however we'll still need the ternary operator to determine if we're hosted by asp.net or not.

@Iristyle how do you recommend we check whether we're running under asp.net?