<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding a authenticated WMS layer to a LayerFile using ArcObjects in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/adding-a-authenticated-wms-layer-to-a-layerfile/m-p/200891#M5211</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to programmatically generate a LayerFile which contains a WMS Layer using ArcObjects. The WMS Server is authenticated. I want to define the WMS Layer within the mapfile, and allow the user to provide credentials when he opens it in ArcMap. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it seems that the process of constructing a WMSLayer in ArcObjects requires connecting. See example below. The problem is, the entity running this code doesn't have credentials. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;QUESTION:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is ther any way to add a WMS Layer to a LayerFile without connecting?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CODE: THIS CODE WORKS BUT IT REQURES CREDENTIALS. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDataLayer pDataLayer = (IDataLayer)pWMSMapLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pDataLayer.Connect((IName)wmsConnect);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI.ArcGIS.GISClient.IWMSServiceDescription pWMSServiceDescription = pWMSMapLayer.WMSServiceDescription;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for (int i = 0; i &amp;lt; pWMSServiceDescription.LayerDescriptionCount; i++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.GISClient.IWMSLayerDescription pLayerDesc = pWMSServiceDescription.get_LayerDescription(i);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWMSLayer pNewWMSLayer = pWMSMapLayer.CreateWMSLayer(pLayerDesc);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ILayer pNewLayer = (ILayer)pNewWMSLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWMSMapLayer.InsertLayer(pNewLayer, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 May 2010 18:09:39 GMT</pubDate>
    <dc:creator>FrankEvans</dc:creator>
    <dc:date>2010-05-14T18:09:39Z</dc:date>
    <item>
      <title>Adding a authenticated WMS layer to a LayerFile using ArcObjects</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/adding-a-authenticated-wms-layer-to-a-layerfile/m-p/200891#M5211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to programmatically generate a LayerFile which contains a WMS Layer using ArcObjects. The WMS Server is authenticated. I want to define the WMS Layer within the mapfile, and allow the user to provide credentials when he opens it in ArcMap. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it seems that the process of constructing a WMSLayer in ArcObjects requires connecting. See example below. The problem is, the entity running this code doesn't have credentials. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;QUESTION:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is ther any way to add a WMS Layer to a LayerFile without connecting?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;CODE: THIS CODE WORKS BUT IT REQURES CREDENTIALS. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDataLayer pDataLayer = (IDataLayer)pWMSMapLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pDataLayer.Connect((IName)wmsConnect);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI.ArcGIS.GISClient.IWMSServiceDescription pWMSServiceDescription = pWMSMapLayer.WMSServiceDescription;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for (int i = 0; i &amp;lt; pWMSServiceDescription.LayerDescriptionCount; i++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.GISClient.IWMSLayerDescription pLayerDesc = pWMSServiceDescription.get_LayerDescription(i);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWMSLayer pNewWMSLayer = pWMSMapLayer.CreateWMSLayer(pLayerDesc);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ILayer pNewLayer = (ILayer)pNewWMSLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pWMSMapLayer.InsertLayer(pNewLayer, 0);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 May 2010 18:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/adding-a-authenticated-wms-layer-to-a-layerfile/m-p/200891#M5211</guid>
      <dc:creator>FrankEvans</dc:creator>
      <dc:date>2010-05-14T18:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a authenticated WMS layer to a LayerFile using ArcObjects</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/adding-a-authenticated-wms-layer-to-a-layerfile/m-p/200892#M5212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried calling ISecureLayer2.ClearPassword before saving the mxd (or .lyr file)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 May 2010 18:38:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/adding-a-authenticated-wms-layer-to-a-layerfile/m-p/200892#M5212</guid>
      <dc:creator>KirkKuykendall</dc:creator>
      <dc:date>2010-05-14T18:38:58Z</dc:date>
    </item>
  </channel>
</rss>

