private static object getCurrentHttpContext()
{
var systemWeb = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName.Contains("System.Web"));
if (systemWeb == null)
throw new InvalidOperationException(Error);
var typ = Type.GetType("System.Web.HttpContext" + ", " + systemWeb.FullName, true, true);
var prop = typ.GetProperty("Current");
//get a reference to the current HTTP context
var context = prop.GetValue(null, null);
if (context == null)
throw new InvalidOperationException(Error);
return context;
}