' Create an object for the ftpServer element.ĭim ftpServerElement As ConfigurationElement = siteElement.GetChildElement("ftpServer") Throw New InvalidOperationException("Element not found!") If (!String.Equals(value, keyValues, StringComparison.OrdinalIgnoreCase))ĭim serverManager As ServerManager = New ServerManagerĭim config As Configuration = serverManager.GetApplicationHostConfigurationĭim sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")ĭim sitesCollection As ConfigurationElementCollection = sitesSection.GetCollectionĭim siteElement As ConfigurationElement = FindElement(sitesCollection, "site", "name", "mySite") Object o = element.GetAttributeValue(keyValues) If (String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase))įor (int i = 0 i < keyValues.Length i += 2) Private static ConfigurationElement FindElement(ConfigurationElementCollection collection, string elementTagName, params string keyValues)įoreach (ConfigurationElement element in collection) Execute the method to start the FTP site. Create an instance of the Start method.ĬonfigurationMethodInstance Start = () Create an object for the ftpServer element.ĬonfigurationElement ftpServerElement = siteElement.GetChildElement("ftpServer") Using (ServerManager serverManager = new ServerManager())Ĭonfiguration config = serverManager.GetApplicationHostConfiguration() ĬonfigurationSection sitesSection = config.GetSection("system.applicationHost/sites") ĬonfigurationElementCollection sitesCollection = sitesSection.GetCollection() ĬonfigurationElement siteElement = FindElement(sitesCollection, "site", "name", (siteElement = null) throw new InvalidOperationException("Element not found!") The following examples enable you to start an FTP site programmatically. The site-specific element is configured at the site-level. In the Manage Website section of the Actions pane, click Start. In the Connections pane, expand the server name, expand the Sites node, and then click the name of the FTP site.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |