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