/// <summary> /// Creazione di un nuovo contesto chiamante ed inserimento in sessione /// </summary> /// <param name="url"></param> /// <returns></returns> public static CallerContext NewContext(string url) { CallerContext context = new CallerContext(url); SetCallerContext(context); return(context); }
/// <summary> /// Impostazione del contesto chiamante /// </summary> /// <param name="callerContext"></param> private static void SetCallerContext(CallerContext callerContext) { Stack stack = HttpContext.Current.Session[SESSION_KEY] as Stack; if (stack == null) { stack = new Stack(); HttpContext.Current.Session.Add(SESSION_KEY, stack); } stack.Push(callerContext); }
/// <summary> /// Reperimento del contesto chiamante /// </summary> /// <returns></returns> public static CallerContext GetCallerContext() { CallerContext context = null; Stack stack = HttpContext.Current.Session[SESSION_KEY] as Stack; if (stack != null) { context = stack.Pop() as CallerContext; } return(context); }