I have some code similar to below that connects to a WMS layer.
var current = new WMSMapLayerClass();
var propSet = new PropertySetClass();
propSet.SetProperty("URL", URL);
propSet.SetProperty("USER", UserName);
propSet.SetProperty("Password", Password);
var connName = new WMSConnectionNameClass();
connName.ConnectionProperties = propSet;
current.Connect(connName);
....
.Document.FocusMap.AddLayer(current);
This works great. However if I save the layers with a mxd and open with ArcMap I need to re enter the password. It does remember the account and the URL just not the password. There is a check box on the connection screen to "Remember Password", that once is checked fixes the issue. The question is how do I "Remember" the password from the arc objects API?Jonathan DeRose Is there anyway we can make this a high priority item. Thanks! Jody Anderson
Solved! Go to Solution.
Update: This has been resolved. There is an undocumented property - HIDEUSERPROPERTY that if is set to false will allow saving of credentials. So the code would be.
propSet.SetProperty("URL", URL); propSet.SetProperty("HIDEUSERPROPERTY", false); propSet.SetProperty("USER", UserName); propSet.SetProperty("Password", Password);
Update: This has been resolved. There is an undocumented property - HIDEUSERPROPERTY that if is set to false will allow saving of credentials. So the code would be.
propSet.SetProperty("URL", URL); propSet.SetProperty("HIDEUSERPROPERTY", false); propSet.SetProperty("USER", UserName); propSet.SetProperty("Password", Password);
Thanks for the tip Erik Hooper, works well on Image Services too!
I wonder what other properties are undocumented. I'm specifically looking for a way to apply a CQL_FILTER. Is this possible?