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
Try this:
using System.Web.Hosting; // ... if (HostingEnvironment.IsHosted) { // You are in ASP.NET } else { // You are in a standalone application }
Worked for me!
See HostingEnvironment.IsHosted for details...