${aspnet-session} Layout Renderer


ASP.NET Session variable.

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

Parameters:

NameTypeDescription
variablestring
Session 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 Session dictionary.

Example:

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

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

Back to the layout renderer list.