Select to view content in your preferred language

Saving credentials with WMS layer

4522
3
Jump to solution
05-21-2015 03:48 PM
ErikHooper
Deactivated User

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

1 Solution

Accepted Solutions
ErikHooper
Deactivated User

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);

View solution in original post

0 Kudos
3 Replies
ErikHooper
Deactivated User

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);
0 Kudos
RowanWinsemius1
Deactivated User

Thanks for the tip Erik Hooper, works well on Image Services too!

WWalker
Occasional Contributor

I wonder what other properties are undocumented.  I'm specifically looking for a way to apply a CQL_FILTER.  Is this possible?

0 Kudos