Application Root

Note that folders (e.g. project folder, database folder, upload folders and audit trail folder) are relative to application root. This enables the user to put the uploaded files and the audit trail log files in folder outside of the script folder. (In older versions, the file upload folder is relative to the script, it was supposed to be a subfolder under the script.)

Where is the application root? ASP Report Maker scripts looks for the application root in the following sequence:

 

1. Root Relative Path

Root Relative Path is the path relative to destination folder. The destination folder is the folder where the generated scripts reside.

When you generate scripts, you must specify the [Application root folder] and the [Destination folder] correctly based on your folder structure. The relative folder structure on your local computer must be the same as that on your production server.

For example, if you put the generated scripts in a subfolder,

In this case, the Root Relative Path is therefore the parent folder of the script, i.e. "..". The scripts will use this relative path to find the application root.

It is recomended that you set the [Application root folder] to the root folder of your Website where is accessed by http://www.mycompany.com/ so you can specify your file folders straightforwardly using the Website root as a starting point. For example, if you specify "upload/" as upload path, since it is relative to application root, the upload folder will be accessible by http://www.mycompany.com/upload/.

On your testing server, you may work with multiple projects and test your projects one folder level lower at http://localhost/<projectname>/ (cf. http://<projectname>/). In this case you should set the [Application root folder] in each project as the root folder of the project (the folder that is accessed by http://localhost/<projectname>/). After uploading to the production server, the site may be then accessed by http://www.mycompany.com/ (cf. http://localhost/<projectname>/), but as long as the relative location of the two folders (Application Root folder and the script folder) are the same, the scripts will still work properly.

 

2. Document root

If Root Relative Path is empty, the script checks the following variables: Request.ServerVariables("APPL_PHYSICAL_PATH").

This variable should return the physical path of the application root of your web site, read Creating Virtual Directories in IIS in Introduction to ASP.

When you generate scripts, you still need to specify the [Application root folder] and the [Destination folder] based on your folder structure so that the relative location of the two folders is correct.

 

3. Script Path

If both Root Relative Path and Document Root are empty, the script will use the path of the current script.

 

4. Custom Path

The above three approaches should handle most cases. If in some special cases they don't return the path you want, you can modify the function ewr_AppRoot() in ewrfn*.asp. You can simply specify your real server path directly. For example,

Function ewr_AppRoot()
    ewr_AppRoot = "C:\Inetpub\wwwroot\MyWebRoot\" ' Include the trailing path delimiter   
End Function

Remember that you must also check the value of the constant EWR_ROOT_RELATIVE_PATH in the generated ewrcfg*.asp, make sure it correctly points to your application folder relative to the script folder. Using above example, you specify that the application root is "C:\Inetpub\wwwroot\MyWebRoot", if your scripts are placed in "C:\Inetpub\wwwroot\MyWebRoot\MyScripts\", then EWR_ROOT_RELATIVE_PATH should be "..".

TIP: In the generated scripts (that includes ewrfn*.asp), you can call the function ewr_WritePaths() (i.e. <%= ewr_WritePaths() %>) to view the path settings in your project.

 



 ©2006-2017 e.World Technology Ltd. All rights reserved.