73d9e5476baf1f748a29839801b051fb3cb90f8f
Guides/MVC-Integration.md
| ... | ... | @@ -61,6 +61,55 @@ Add _sitelayout (mvc5r3\Views\Shared) to the project’s Shared under Views |
| 61 | 61 | |
| 62 | 62 | Copy code from Global.asax except the first line and paste in project’s Global.asax |
| 63 | 63 | |
| 64 | + |
|
| 65 | +##Global.asax from mvc5r3(C♯) |
|
| 66 | + |
|
| 67 | +```csharp |
|
| 68 | + |
|
| 69 | +<%@ Application Codebehind="Global.asax.cs" Inherits="MVC4Razor2.MvcApplication" Language="C#" %> //Copy except this line |
|
| 70 | +<%@ Import Namespace="Izenda.AdHoc"%> |
|
| 71 | +<%@ Import Namespace="System.IO"%> |
|
| 72 | + |
|
| 73 | +<script runat="server"> |
|
| 74 | + void Application_AcquireRequestState(object sender, EventArgs e) { |
|
| 75 | + CustomAdHocConfig.InitializeReporting(); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + [Serializable] |
|
| 79 | + public class CustomAdHocConfig : FileSystemAdHocConfig { |
|
| 80 | + public static void InitializeReporting() { |
|
| 81 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 82 | + return; |
|
| 83 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 84 | + AdHocSettings.SqlServerConnectionString = @"INSERT_CONNECTION_STRING_HERE"; |
|
| 85 | + AdHocSettings.GenerateThumbnails = true; |
|
| 86 | + AdHocSettings.ShowSimpleModeViewer = true; |
|
| 87 | + AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$"; |
|
| 88 | + AdHocSettings.TabsCssUrl = "/Resources/css/tabs.css"; |
|
| 89 | + AdHocSettings.ReportCssUrl = "../Resources/css/Report.css"; |
|
| 90 | + AdHocSettings.ShowBetweenDateCalendar = true; |
|
| 91 | + AdHocSettings.DashboardViewer = "Dashboards"; |
|
| 92 | + AdHocSettings.ReportViewer = "ReportViewer"; |
|
| 93 | + AdHocSettings.InstantReport = "InstantReport"; |
|
| 94 | + AdHocSettings.ReportDesignerUrl = "ReportDesigner"; |
|
| 95 | + AdHocSettings.DashboardDesignerUrl = "DashboardDesigner"; |
|
| 96 | + AdHocSettings.ReportList = "ReportList"; |
|
| 97 | + AdHocSettings.SettingsPageUrl = "Settings"; |
|
| 98 | + AdHocSettings.ParentSettingsUrl = "Settings"; |
|
| 99 | + AdHocSettings.ResponseServer = "rs.aspx"; |
|
| 100 | + AdHocSettings.ReportsPath = Path.Combine(HttpContext.Current.Server.MapPath("~/"), "Reports"); |
|
| 101 | + AdHocSettings.PrintMode = PrintMode.Html2PdfAndHtml; |
|
| 102 | + AdHocSettings.ChartingEngine = ChartingEngine.HtmlChart; |
|
| 103 | + AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 104 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | +</script> |
|
| 108 | + |
|
| 109 | +``` |
|
| 110 | + |
|
| 111 | + |
|
| 112 | + |
|
| 64 | 113 |  |
| 65 | 114 | |
| 66 | 115 | ###Step 9. Copy specificFilerouter and IzendaResource constraint classes from Globa.asax.cs and paste them above MVCapplication class in Global.asax.cs of the project |