Loading a password-protected document
A published map file (PMF) is a document that is created using the ArcGIS for Desktop Publisher extension. A PMF can be used in an ArcGIS Engine application by loading it into the MapControl and PageLayoutControl if the PMF was published with access to internal objects. At the time of publishing, a PMF can be password protected.
- When loading a PMF, use the IMapDocument.IsPasswordProtected method to determine whether the document is password protected. See the following code example:
// Check if the map document is password protected.
IMapDocument mapDoc;
mapDoc=new MapDocumentClass();
bool bPass=mapDoc.get_IsPasswordProtected(@"c:\data\mydoc.pmf");
[VB.NET] ' Check if the map document is password protected.
Dim mapDoc As IMapDocument
mapDoc=New MapDocumentClass
bool bPass=mapDoc.IsPasswordProtected("c:\data\mydoc.pmf")
- If the document is password protected, the password must be passed to the IPageLayoutControl.LoadMxFile or IMapControl2.LoadMxFile methods.
The following code example shows the password as hard-coded to highlight how the password is used. However, it makes more sense to prompt the user for a password. For a full code example that includes making a password prompt and displaying it, see Load a map document into the PageLayoutControl.
//Load a password-protected document into a PageLayoutControl.
string password="my password";
axPageLayoutControl1.LoadMxFile(@"c:\data\mydoc.pmf", password);
[VB.NET] 'Load a password-protected document into a PageLayoutControl.
String password="my password"
AxPageLayoutControl1.LoadMxFile("c:\data\mydoc.pmf", password)
See Also:
Samples:Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |