public static IApplication GetLocalhMailServerApplication() { hMailServerNetRemote.ClassFactory cf = new ClassFactory(); hMailServerNetRemote.IApplication app; if (HttpContext.Current.Session["hMailServerNetRemoteApplication"] == null) { app = cf.CreateApplication(); HttpContext.Current.Session["hMailServerNetRemoteApplication"] = app; } else { app = (hMailServerNetRemote.IApplication)HttpContext.Current.Session["hMailServerNetRemoteApplication"]; } return(app); }