${aspnet-application} Layout Renderer ASP.NET Application 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.ASPNETApplicationValueLayoutRenderer |  |  |  | | |  |  |  |  |
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 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. |