API/CodeSamples/ChartLandscapePrintWidth.md
... ...
@@ -18,13 +18,13 @@ public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
18 18
// Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
19 19
public static void InitializeReporting() {
20 20
//Check to see if we've already initialized.
21
- if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
21
+ if (AdHocContext.Initialized)
22 22
return;
23 23
AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
24 24
AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
25 25
Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
26 26
AdHocSettings.ChartLandscapePrintWidth = 2000; //The relevant setting
27
- HttpContext.Current.Session["ReportingInitialized"] = true;
27
+ AdHocContext.Initialized = true;
28 28
}
29 29
}
30 30
```
... ...
@@ -39,14 +39,14 @@ Public Class CustomAdHocConfig
39 39
40 40
Shared Sub InitializeReporting()
41 41
'Check to see if we've already initialized
42
- If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
42
+ If AdHocContext.Initialized Then
43 43
Return
44 44
'Initialize System
45 45
AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
46 46
AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
47 47
Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
48 48
AdHocSettings.ChartLandscapePrintWidth = 2000 'The relevant setting
49
- HttpContext.Current.Session("ReportingInitialized") = True
49
+ AdHocContext.Initialized = True
50 50
End Sub
51 51
End Class
52 52
```
... ...
\ No newline at end of file