AspNetSessionValueLayoutRenderer Class |
Namespace: NLog.Web.LayoutRenderers
The AspNetSessionValueLayoutRenderer type exposes the following members.
Name | Description | |
---|---|---|
AspNetSessionValueLayoutRenderer | Initializes a new instance of the AspNetSessionValueLayoutRenderer class |
Name | Description | |
---|---|---|
Culture |
Gets or sets the culture used for rendering.
| |
EvaluateAsNestedProperties | Obsolete.
Gets or sets whether variables with a dot are evaluated as properties or not
| |
Format |
Format string for conversion from object to string.
| |
HttpContextAccessor |
Provides access to the current request HttpContext.
(Inherited from AspNetLayoutRendererBase.) | |
Item |
Gets or sets the session item name.
| |
LoggingConfiguration |
Gets the logging configuration this target is part of.
(Inherited from LayoutRenderer.) | |
ObjectPath |
Gets or sets the object-property-navigation-path for lookup of nested property
| |
ValueFormatter |
Value formatter
(Inherited from LayoutRenderer.) | |
ValueType |
The type of the value.
| |
Variable | Obsolete.
Gets or sets the session item name.
|
Name | Description | |
---|---|---|
Append |
Validates that the HttpContext is available and delegates append to subclasses.StringBuilder.
(Inherited from AspNetLayoutRendererBase.) | |
CloseLayoutRenderer |
Closes the layout renderer.
(Inherited from AspNetLayoutRendererBase.) | |
DoAppend |
Renders the value of layout renderer in the context of the specified log event into StringBuilder.
(Overrides AspNetLayoutRendererBaseDoAppend(StringBuilder, LogEventInfo).) | |
GetCulture |
Get the CultureInfo for rendering the messages to a String (Inherited from LayoutRenderer.) | |
GetFormatProvider |
Get the IFormatProvider for rendering the messages to a String (Inherited from LayoutRenderer.) | |
InitializeLayoutRenderer |
Initializes the layout renderer.
(Inherited from LayoutRenderer.) | |
Render |
Renders the value of layout renderer in the context of the specified log event.
(Inherited from LayoutRenderer.) | |
ResolveServiceT |
Resolves the interface service-type from the service-repository
(Inherited from LayoutRenderer.) | |
ToString | Returns a string that represents the current object. (Inherited from LayoutRenderer.) |
1${aspnet-session-item:myKey} - produces "123" 2${aspnet-session-item:anotherKey} - produces "01/01/2006 00:00:00" 3${aspnet-session-item:anotherKey:culture=pl-PL} - produces "2006-01-01 00:00:00" 4${aspnet-session-item:myKey:padding=5} - produces " 123" 5${aspnet-session-item:myKey:padding=-5} - produces "123 " 6${aspnet-session-item:stringKey:upperCase=true} - produces "AAA BBB"
You can set the value of an ASP.NET Session variable by using the following code:
1HttpContext.Current.Session["myKey"] = 123; 2HttpContext.Current.Session["stringKey"] = "aaa BBB"; 3HttpContext.Current.Session["anotherKey"] = DateTime.Now;