Web API Reference | MapGuide Open Source |
Creates a session repository for the current user.
.NET Syntax
Java Syntax
PHP Syntax
Examples (PHP)
This example shows how to create a session repository. Note how the session ID is stored back in the MgUserInformation object. This is necessary for GetCurrentSession to work. // Initialize the web tier MgInitializeWebTier('C:\Inetpub\wwwroot\PhpMapAgent\webconfig.ini'); // Establish a connection to a site. $userInformation = new MgUserInformation('Administrator', 'admin'); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInformation); // Create a session repository $site = $siteConnection->GetSite(); $sessionID = $site->CreateSession(); $userInformation->SetMgSessionId($sessionID); This example shows how to reauthenticate using the session ID: // Assuming this page was called by // <A href="page_two.php?sessionId=<?= $site->GetCurrentSession(); ?>">Page Two</A> $userInformation = new MgUserInformation($_GET['sessionId']); This example shows how to enumerate the resources in the session repository: $sessionName = "Session:$sessionID//"; $resourceID = new MgResourceIdentifier($sessionName); $byteReader = $resourceService->EnumerateResources($resourceID, -1, "");
|