${aspnet-session} Layout Renderer
ASP.NET Session variable.
| Assembly | Class | .NET Framework | .NET CF | Mono on Windows | Mono on Unix |
|---|
| 1.0 | 1.1 | 2.0 | 1.0 | 2.0 | 1.0 | 2.0 | 1.0 | 2.0 |
|---|
| NLog.dll | NLog.LayoutRenderers.ASPNETSessionValueLayoutRenderer |  |  |  | | |  |  |  |  |
Parameters:
| Name | Type | Description |
|---|
| variable | string | |
| culture | string | | The culture name to be used for rendering. |
|
| cultureInfo | CultureInfo | | The CultureInfo to be used for rendering. |
|
| fixedLength | boolean | | Trim the rendered text to the AbsolutePadding value. Default value is: False. |
|
| lowerCase | boolean | | Render an upper-case string. Default value is: False. |
|
| padCharacter | Char | |
| padding | integer | |
| upperCase | boolean | | 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.