internal static void Initialize(IConnection connection) { FluorineRtmpContext fluorineContext = new FluorineRtmpContext(connection); WebSafeCallContext.SetData(FluorineContext.FluorineContextKey, fluorineContext); if (log.IsDebugEnabled) { log.Debug(__Res.GetString(__Res.Context_Initialized, connection.ConnectionId, connection.Client != null ? connection.Client.Id : "[not set]", connection.Session != null ? connection.Session.Id : "[not set]")); } }
/// <summary> /// Stores a given object and associates it with the specified name. /// </summary> /// <param name="name">The name with which to associate the new item in the call context.</param> /// <param name="value">The object to store in the call context.</param> public static void SetData(string name, object value) { #if !FXCLIENT HttpContext ctx = HttpContext.Current; if (ctx != null) { ctx.Items[name] = value; return; } #endif try { // See if we're running in full trust new SecurityPermission(SecurityPermissionFlag.Infrastructure).Demand(); WebSafeCallContext.SetData(name, value); } catch (SecurityException) { Data[name] = value; } }
/// <summary> /// Retrieves an object with the specified name from the FluorineWebSafeCallContext. /// </summary> /// <param name="name">The name of the item in the call context.</param> /// <returns>The object in the call context associated with the specified name.</returns> public static object GetData(string name) { #if !FXCLIENT HttpContext ctx = HttpContext.Current; if (ctx != null) { return(ctx.Items[name]); } #endif object value; try { // See if we're running in full trust new SecurityPermission(SecurityPermissionFlag.Infrastructure).Demand(); value = WebSafeCallContext.GetData(name); } catch (SecurityException) { value = Data[name]; } return(value); }
/// <summary> /// Empties a data slot with the specified name. /// </summary> /// <param name="name">The name of the data slot to empty.</param> public static void FreeNamedDataSlot(string name) { #if !FXCLIENT HttpContext ctx = HttpContext.Current; if (ctx != null) { ctx.Items.Remove(name); return; } #endif try { // See if we're running in full trust new SecurityPermission(SecurityPermissionFlag.Infrastructure).Demand(); WebSafeCallContext.FreeNamedDataSlot(name); } catch (SecurityException) { Data.Remove(name); } }