-
Notifications
You must be signed in to change notification settings - Fork 0
AspNetItem layout renderer
Julian Verdurmen edited this page Jan 8, 2016
·
1 revision
ASP.NET Item variable.
Use this layout renderer to insert the value of the specified variable stored
in the ASP.NET HttpContext.Current.Items
dictionary.
Supported in .NET and Mono
##Configuration Syntax
${aspnet-item:variable=String;evaluateAsNestedProperties:boolean}
##Parameters ###Rendering Options
- variable - Variable name.
-
EvaluateAsNestedProperties - boolean. Default:
false
. Evaluate the as nested properties. The dots in thevariable
are special interpreted. See example below.
##Examples
You can set the value of an ASP.NET Item variable by using the following code:
Example usage of ${aspnet-item}
HttpContext.Current.Items["myvariable"] = 123;
HttpContext.Current.Items["stringvariable"] = "aaa BBB";
HttpContext.Current.Items["anothervariable"] = DateTime.Now;
${aspnet-item:variable=myvariable} - produces "123"
${aspnet-item:variable=anothervariable} - produces "01/01/2006 00:00:00"
${aspnet-item:variable=anothervariable:culture=pl-PL} - produces "2006-01-01 00:00:00"
${aspnet-item:variable=myvariable:padding=5} - produces " 123"
${aspnet-item:variable=myvariable:padding=-5} - produces "123 "
${aspnet-item:variable=stringvariable:upperCase=true} - produces "AAA BBB"
- Search in documentation
- Getting started
- Examples
- External articles and tutorials
- FAQ
- Platform support
- Advanced Configuration file options
- Filtering log messages
- [Using Time Sources](Time Source)
- Visual Studio support
- Who is using NLog
- [Write custom extensions](Extending NLog)