Click or drag to resize

AspNetApplicationValueLayoutRenderer Class

ASP.NET HttpContext Application Dictionary Item Value.
Inheritance Hierarchy
SystemObject
  NLog.LayoutRenderersLayoutRenderer
    NLog.Web.LayoutRenderersAspNetLayoutRendererBase
      NLog.Web.LayoutRenderersAspNetApplicationValueLayoutRenderer

Namespace:  NLog.Web.LayoutRenderers
Assembly:  NLog.Web (in NLog.Web.dll) Version: 5.3.13+628b0876960af3ee3454c99b7985dbb5e1c46bf0
Syntax
public class AspNetApplicationValueLayoutRenderer : AspNetLayoutRendererBase

The AspNetApplicationValueLayoutRenderer type exposes the following members.

Constructors
  NameDescription
Public methodAspNetApplicationValueLayoutRenderer
Initializes a new instance of the AspNetApplicationValueLayoutRenderer class
Top
Properties
  NameDescription
Public propertyCulture
Gets or sets the culture used for rendering.
Public propertyFormat
Format string for conversion from object to string.
Public propertyHttpContextAccessor
Provides access to the current request HttpContext.
(Inherited from AspNetLayoutRendererBase.)
Public propertyItem
Gets or sets the item variable name.
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from LayoutRenderer.)
Public propertyObjectPath
Gets or sets the object-property-navigation-path for lookup of nested property
Protected propertyValueFormatter
Value formatter
(Inherited from LayoutRenderer.)
Public propertyVariable Obsolete.
Gets or sets the variable name.
Top
Methods
  NameDescription
Protected methodAppend
Validates that the HttpContext is available and delegates append to subclasses.StringBuilder.
(Inherited from AspNetLayoutRendererBase.)
Protected methodCloseLayoutRenderer
Closes the layout renderer.
(Inherited from AspNetLayoutRendererBase.)
Protected methodDoAppend
Renders the value of layout renderer in the context of the specified log event into StringBuilder.
(Overrides AspNetLayoutRendererBaseDoAppend(StringBuilder, LogEventInfo).)
Protected methodGetCulture
Get the CultureInfo for rendering the messages to a String
(Inherited from LayoutRenderer.)
Protected methodGetFormatProvider
Get the IFormatProvider for rendering the messages to a String
(Inherited from LayoutRenderer.)
Protected methodInitializeLayoutRenderer
Initializes the layout renderer.
(Inherited from LayoutRenderer.)
Public methodRender
Renders the value of layout renderer in the context of the specified log event.
(Inherited from LayoutRenderer.)
Protected methodResolveServiceT
Resolves the interface service-type from the service-repository
(Inherited from LayoutRenderer.)
Public methodToString
Returns a string that represents the current object.
(Inherited from LayoutRenderer.)
Top
Remarks
1${aspnet-application:item=myvariable} - produces "123"
2${aspnet-application:item=anothervariable} - produces "01/01/2006 00:00:00"
3${aspnet-application:item=anothervariable:culture=pl-PL} - produces "2006-01-01 00:00:00"
4${aspnet-application:item=myvariable:padding=5} - produces "  123"
5${aspnet-application:item=myvariable:padding=-5} - produces "123  "
6${aspnet-application:item=stringvariable:upperCase=true} - produces "AAA BBB"
Examples

You can set the value of an ASP.NET Application variable by using the following code:

C#
1HttpContext.Current.Application["myvariable"] = 123;
2HttpContext.Current.Application["stringvariable"] = "aaa BBB";
3HttpContext.Current.Application["anothervariable"] = DateTime.Now;
See Also