Last updated: 2006-09-18

This website is based on NLog v1.0. Click here to view the documentation for other versions.

${aspnet-application} Layout Renderer


ASP.NET Application variable.

AssemblyClass.NET Framework.NET CFMono on WindowsMono on Unix
1.01.12.01.02.01.02.01.02.0
NLog.dllNLog.LayoutRenderers.ASPNETApplicationValueLayoutRenderer  

Parameters:

NameTypeDescription
variablestring
The variable name.
culturestring
The culture name to be used for rendering.
cultureInfoCultureInfo
The CultureInfo to be used for rendering.
fixedLengthboolean
Trim the rendered text to the AbsolutePadding value.

Default value is: False.

lowerCaseboolean
Render an upper-case string.

Default value is: False.

padCharacterChar
The padding character.
paddinginteger
Padding value.
upperCaseboolean
Render an upper-case string.

Default value is: False.

Remarks:

Use this layout renderer to insert the value of the specified variable stored in the ASP.NET Application dictionary.

Example:

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

HttpContext.Current.Application["myvariable"] = 123; 
HttpContext.Current.Application["stringvariable"] = "aaa BBB"; 
HttpContext.Current.Application["anothervariable"] = DateTime.Now;
Example usage of ${aspnet-application}:
${aspnet-application:variable=myvariable} - produces "123" 
${aspnet-application:variable=anothervariable} - produces "01/01/2006 00:00:00" 
${aspnet-application:variable=anothervariable:culture=pl-PL} - produces "2006-01-01 00:00:00" 
${aspnet-application:variable=myvariable:padding=5} - produces "  123" 
${aspnet-application:variable=myvariable:padding=-5} - produces "123  " 
${aspnet-application:variable=stringvariable:upperCase=true} - produces "AAA BBB" 

Back to the layout renderer list.
Webwww.nlog-project.org