MicroStrategy ONE
Development in a .NET Environment
Regardless of whether your MicroStrategy application is deployed through the J2EE or .NET version of MicroStrategy Web products, custom application development should always be done with best practices in mind. Best practices dictate that wherever possible, you must use the MicroStrategy Web and SDK's component-based architecture to accomplish the particular customization task. This means that even when you are customizing the .NET version of MicroStrategy Web products, most of the custom code you write should be written in Java using the Web SDK's component-based architecture.
There may be some occasions where you might be required to write .NET code in a .NET environment to communicate between MicroStrategy Web and some external Microsoft-based application. Users who are familiar with software development in J2EE or ASP may be used to writing code directly in JSPs or ASPs. In the .NET version of MicroStrategy Web products, the business logic and presentation logic are separated into different files. Specifically, business logic and .NET code must be written in vb code-behind files, while only HTML and other defined tags or Web controls can be used in the presentation pages (ascx or aspx files).
You cannot write .NET code (C#, VB.NET, etc.) directly in the presentation pages (ascx or aspx files).
Every MicroStrategy Web page is based on an aspx template file as well as some number of ascx page-section files, each of which is responsible for actually outputting and displaying content. vb code-behind files contain any code-based logic that resides behind the presentation of HTML output. For example, mstrWeb.aspx is responsible for determining the presentation of information on a MicroStrategy page while mstrWeb.aspx.vb is responsible for the code that determines which files should be used to fill in the page sections for that page.
If you want to write custom logic or .NET code in the MicroStrategy Web environment (for the MicroStrategy Web product that uses the architecture with the .NET presentation layer), you must write it in some vb code-behind file in such a way that it can be called and executed from an associated presentation page.
To facilitate easier upgrades for your .NET development efforts in the future, put all of your custom code in a single place, at the end of the code in either the mstrControls.vb or mstrTagLib.vb files. These two files are described below.
-
mstrTagLib.vb: Contains functions whose goal is to render output. These functions can be called as Web controls (custom HTML tags) from any of the presentation pages (ascx or aspx files) in the application. For additional details on creating a new page, refer to Adding a new page.
-
mstrControls.vb: Contains execution functions whose goal is not to render data to the output stream, but rather to facilitate MicroStrategy Web request execution, initializing the request process, processing user requests, loading pages, and passing data from the request through the .NET bridges to the Java layers of MicroStrategy Web.
While the .NET environment provides other alternatives for inserting custom code, placing all your custom code in these two places makes it easy for you to copy your changes into a future release of MicroStrategy Web, even if the future release includes many file updates by MicroStrategy.
Local versus global access
Local access: If you create a new presentation page (ascx or aspx file) and want the custom code to only be accessible to that one page, then you can write the custom code in the page’s corresponding vb code-behind file and its effect will be local within the application. For example, any code you write in MyFolder_content.ascx.vb is accessible only to MyFolder_content.ascx. For additional details on creating a new page, refer to the Creating a New Page-section or Page-template File topic.
Global access: If you want to write custom code that can be accessed by many presentation files, include the code in a global vb file. You can always create a separate vb code-behind file that contains your custom code.