2cf057bf5ae9b975b98404d756886ebce836a79f
Guides/MVC-Integration.md
| ... | ... | @@ -109,6 +109,51 @@ Copy code from Global.asax except the first line and paste in project’s Global |
| 109 | 109 | ``` |
| 110 | 110 | |
| 111 | 111 | |
| 112 | +The below is how the project's Global.asax should look like. |
|
| 113 | +##Global.asax from Sample_MVCApp(C♯) |
|
| 114 | +```csharp |
|
| 115 | +<%@ Application Codebehind="Global.asax.cs" Inherits="Sample_MVCApp.MvcApplication" Language="C#" %> |
|
| 116 | + |
|
| 117 | + |
|
| 118 | +<%@ Import Namespace="Izenda.AdHoc"%> |
|
| 119 | +<%@ Import Namespace="System.IO"%> |
|
| 120 | + |
|
| 121 | +<script runat="server"> |
|
| 122 | + void Application_AcquireRequestState(object sender, EventArgs e) { |
|
| 123 | + CustomAdHocConfig.InitializeReporting(); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + [Serializable] |
|
| 127 | + public class CustomAdHocConfig : FileSystemAdHocConfig { |
|
| 128 | + public static void InitializeReporting() { |
|
| 129 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 130 | + return; |
|
| 131 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 132 | + AdHocSettings.SqlServerConnectionString = @"INSERT_CONNECTION_STRING_HERE"; |
|
| 133 | + AdHocSettings.GenerateThumbnails = true; |
|
| 134 | + AdHocSettings.ShowSimpleModeViewer = true; |
|
| 135 | + AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$"; |
|
| 136 | + AdHocSettings.TabsCssUrl = "/Resources/css/tabs.css"; |
|
| 137 | + AdHocSettings.ReportCssUrl = "../Resources/css/Report.css"; |
|
| 138 | + AdHocSettings.ShowBetweenDateCalendar = true; |
|
| 139 | + AdHocSettings.DashboardViewer = "Dashboards"; |
|
| 140 | + AdHocSettings.ReportViewer = "ReportViewer"; |
|
| 141 | + AdHocSettings.InstantReport = "InstantReport"; |
|
| 142 | + AdHocSettings.ReportDesignerUrl = "ReportDesigner"; |
|
| 143 | + AdHocSettings.DashboardDesignerUrl = "DashboardDesigner"; |
|
| 144 | + AdHocSettings.ReportList = "ReportList"; |
|
| 145 | + AdHocSettings.SettingsPageUrl = "Settings"; |
|
| 146 | + AdHocSettings.ParentSettingsUrl = "Settings"; |
|
| 147 | + AdHocSettings.ResponseServer = "rs.aspx"; |
|
| 148 | + AdHocSettings.ReportsPath = Path.Combine(HttpContext.Current.Server.MapPath("~/"), "Reports"); |
|
| 149 | + AdHocSettings.PrintMode = PrintMode.Html2PdfAndHtml; |
|
| 150 | + AdHocSettings.ChartingEngine = ChartingEngine.HtmlChart; |
|
| 151 | + AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 152 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | +</script> |
|
| 156 | +``` |
|
| 112 | 157 | |
| 113 | 158 |  |
| 114 | 159 |