I have an instance of a general purpose class that will be executed both under ASP.NET and a stand alone program. This code is sensative to the process where it is being run
using System.Diagnostics; if (Process.GetCurrentProcess().ProcessName == "w3wp") //ASP.NET