How This Page Works

This example page performs the following operations:

1. Get session information.

   When you first go to the URL containing the web layout, the Viewer initiates a new session. It prompts for a user id and password, and uses these to validate with the site server. If the user id and password are valid, the site server creates a session and sends the session id back to the viewer.

   The Viewer passes the session information every time it sends a request to a MapGuide page. The pages use this information to re-establish a session.

2. Perform basic initialization.

   The webconfig.ini file contains parameters required to connect to the site server, including the IP address and port numbers to use for communication. MgInitializeWebTier() reads the file and gets the necessary values to find the site server and create a connection.

3. Get user information.

   The site server saves the user credentials along with other session information. These credentials must be supplied when the user first connects to the site. At that time, the Viewer authenticates the user and creates a new session using the credentials. Using the session ID, other pages can get an encrypted copy of the user credentials that can be used for authentication.

4. Create a site connection.

   Any MapGuide pages require a connection to a site server, which manages the repository and site services.

5. Create a connection to a resource service.

   Access to resources is handled by a resource service. In this case, the page needs a resource service in order to retrieve information about the map resource.

   You may need to create connections to other services, depending on the needs of your application.

6. Retrieve map details.

   The map name is also passed by the viewer to the MapGuide page. Use this name to open a particular map resource with the resource service. Once the map is open you can get other information. This example displays the spatial reference system used by the map, but you can also get more complex information about the layers that make up the map.