API/CodeSamples/CacheExternalResources.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.CacheExternalResources = false; //The relevant setting
29
- HttpContext.Current.Session["ReportingInitialized"] = true;
29
+ AdHocContext.Initialized = true;
30 30
}
31 31
}
32 32
```
... ...
@@ -40,14 +40,14 @@ Public Class CustomAdHocConfig
40 40
41 41
Shared Sub InitializeReporting()
42 42
'Check to see if we've already initialized
43
- If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
43
+ If AdHocContext.Initialized Then
44 44
Return
45 45
'Initialize System
46 46
AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
47 47
AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
48 48
Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
49 49
AdHocSettings.CacheExternalResources = False 'The relevant setting
50
- HttpContext.Current.Session("ReportingInitialized") = True
50
+ AdHocContext.Initialized = True
51 51
End Sub
52 52
End Class
53 53
```
... ...
\ No newline at end of file