Tutorial - Compatibility Properties - Integrating with existing ASP.NET Maker project

Note: Before reading this tutorial, please read Compatibility Properties Setup first.

In this tutorial we will show you how to put scripts generated by ASP.NET Report Maker together with scripts generated by ASP.NET Maker. We'll use security in both projects and demonstrate how you can make them compatible with each other.

To make ASP.NET Maker and ASP.NET Report Maker projects work together, there are 3 requirements:

  1. The projects share the same web folder. In general, the projects share the same application root and destination folder.
  2. The projects share the same project name.
  3. If Advanced Security is used, they shares the same Advanced Security settings, including the User ID field, Parent User ID field, User Level field and User Levels.

Project name in ASP.NET Report Maker or ASP.NET Maker is used in session variable to distinguish projects. For example, if the project name of your ASP.NET Maker project is named as "project1", the session variable of the logged in status is Session("project1_status"). If your project name of your ASP.NET Report Maker project is named as "project2", when users browse from ASP.NET Maker generated pages to ASP.NET Report Maker generated pages, you will be considered as not logged in and be redirected to the login page. Therefore, to make ASP.NET Report Maker project compatible with ASP.NET Maker project, we need to use the same project name for both projects.

Select one of your ASP.NET Maker projects that uses security, check the project name (see Project File). We open the project file with a text editor (e.g. Notepad) to check the actual project name. It can be found in the <project> tag, for example, if you see:

<Project Version="8.1.0.0" ProjName="demo" ...(omitted).../>

The project name of the ASP.NET Maker project is "demo", we'll use the same project name in ASP.NET Report Maker.

On the other hand, ASP.NET application generated by ASP.NET Report Maker is self-contained, it has its own header, footer, login, logout and default page. However, if you have an existing ASP.NET application generated by ASP.NET Maker, you may already have those pages already. Since those pages typically have the same name like "masterpage.master", "login.aspx", "logout.aspx" and "default.aspx", generating your ASP.NET Report Maker project to the same folder may create several problems:

  1. The header, footer, login, logout and default page of the existing application may be overwritten.

  2. Even if they are different (so they will not be overwritten), you'll need to maintain 2 sets of master pages. To make the look and feel of your site consistent, you'll need to make the 2 sets of header and footer look the same too.

  3. If both projects uses security, each project has its own login and logout page, users will need to login or logout twice.

To solve these problem, ASP.NET Report Maker allows you to enable Compatibility Properties. When enabled, ASP.NET Report Maker will behaves a little differently during generation. If existing paths are specified, the header, footer, login, logout and default pages will not be generated so they won't overwrite existing files. Instead, the generated scripts will use the paths of header, footer, login, logout and default pages specified by the Compatibility Properties so both ASP.NET application shares the common files. Therefore, once you have customized the header and footer for use with both ASP.NET applications, they will not be overwritten when you re-generate scripts using ASP.NET Report Maker.

Note: If you enable Compatibility Properties but not specify the paths of header, footer, login, logout and default pages, the pages will still be generated if necessary. For example, if your ASP.NET Maker project does not use security but your ASP.NET Report Maker project does, you have no paths for the login page and logout page to specify, you leave them empty in the Compatibility Properties form and ASP.NET Report Maker will generate the login and logout pages for the reports.

 

Steps to Setup Compatibility Properties

1. Loading ASP.NET Report Maker

Open ASP.NET Report Maker, open the ASP.NET Report Maker Project you previously used in the Advanced Security tutorials (Tutorial - User ID Security or Tutorial - User Level Security). Compare the Advanced Security settings with that in your ASP.NET Maker project. Check the User ID field, Parent User ID field, User Level field and User Levels.

IMPORTANT: The Advanced Security settings in both projects must be the same.

2. Setting up Compatibility Properties

You can setup using EITHER of the following 2 methods:

2a. Setup in ASP.NET Maker (Requires ASP.NET Maker 8.1 or later)

If the existing ASP.NET application is generated by ASP.NET Maker 8.1 or later, the compatibiltiy can be set up much more easily in the ASP.NET Maker project. ASP.NET Maker can load the ASP.NET Report Maker project, set up above properties automatically and load the menu items from the ASP.NET Report Maker project to the ASP.NET Maker project. Since ASP.NET Maker will update your ASP.NET Report Maker project, to avoid overwriting each other, you should save your ASP.NET Report Maker project and close ASP.NET Report Maker first. Then in ASP.NET Maker, open the Menu Editor, click the [Import] button in the toolbar, select your ASP.NET Report Maker project (4.0 or later), then click [OK]. The imported menu items will be represented by orange icons, you can then re-arrange the display order of the menu items if necessary.

Note: If you change User Level settings in your ASP.NET Report Maker project later, the imported menu items in the ASP.NET Maker project will NOT be updated automatically, you'll need to repeat above again.

OR

2b. Setup in ASP.NET Report Maker

In the main toolbar, click [Tools] -> [Compatibility Properties].

Enter "project1" in the [Project name] textbox. (The actual project name depends on your ASP.NET Maker project.)

Check [Enable compatibility properties], enter the file name of the header, footer, login, logout and default pages in your ASP.NET Maker project.

Enter the path of the login page generated by ASP.NET Maker into the [Login page] textbox. Similarly for the [Logout page] setting.

In this tutorial, we assume you use default settings in your ASP.NET Maker project, so we just enter the following settings:

Click [OK] to save.

3. ASP.NET Script Generation

Go to the [Generate] tab, select the same [Application root folder] and [Destination folder] as in your ASP.NET Maker project. Click the [Generate] button and ASP.NET Report Maker will generate the required ASP.NET scripts automatically.

4. Customizing the Menu

When compatibility properties are enabled, ASP.NET Report Maker will generate the default page as rdefault.aspx (with a leading "r") by default (unless you modify the control.xml in the template). You can customize the menu in the existing ewmenu.ascx (generated by ASP.NET Maker), add a menu item and link it to rdefault.aspx so user can access the new reports added to your site.

5. Running the ASP.NET Application

Run your existing ASP.NET application with your browser, try type "rdefault.aspx" in the address bar. If you have not logged in, you'll be redirected to the login page, If your ASP.NET Maker project uses security, you should find yourself been redirected to the login page from the ASP.NET Maker project.

Login so you can browse the existing ASP.NET Maker pages.

Now click the new link you have just added to your menu to view the reports. You'll be redirected to the default report you specified in your ASP.NET Report Maker project without the need to login again.

Check the User ID security or User Level security by browsing the reports and you'll find that it works as expected.

 

 

 
 ©2007-2010 e.World Technology Ltd. All rights reserved.