API/CodeSamples/AdHocUserKey.md
... ...
@@ -0,0 +1,54 @@
1
+#AdHocUserKey
2
+
3
+[[_TOC_]]
4
+
5
+Gets or sets a single password limiting access to the report designer, report list, and report viewer. This setting is **only** for projects that do not need multi-user security. When set, a security key will be requested when a user attempts to access any of the aforementioned reporting pages.
6
+
7
+##Global.asax (C♯)
8
+
9
+```csharp
10
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
11
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
12
+{
13
+ // Configure settings
14
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
15
+ public static void InitializeReporting() {
16
+ //Check to see if we've already initialized.
17
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
18
+ return;
19
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
20
+ //Creates a connection to Microsoft SQL Server
21
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
22
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
23
+ HttpContext.Current.Session["ReportingInitialized"] = true;
24
+ }
25
+
26
+ //Add custom settings below
27
+ public override void ConfigureSettings() {
28
+ AdHocSettings.AdHocUserKey = "userkey";
29
+ }
30
+}
31
+```
32
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
33
+Public Class CustomAdHocConfig
34
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
35
+
36
+ 'Configure settings
37
+ 'Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
38
+ Shared Sub InitializeReporting()
39
+ 'Check to see if we've already initialized.
40
+ If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
41
+ Return
42
+ 'Initialize System
43
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
44
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
45
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
46
+ HttpContext.Current.Session("ReortingInitialized") = True
47
+ End Sub
48
+
49
+ 'Add custom settings below
50
+ Public Overrides Sub ConfigureSettings()
51
+ AdHocSettings.AdHocUserKey = "userkey"
52
+ End Sub
53
+End Class
54
+##
... ...
\ No newline at end of file