Create IIS6 or IIS7 virtual directory on a website with hostheader, with C# and NANT

2 Comments

using System; using System.DirectoryServices; using System.Globalization; using Ada.Configurator.Common; using NAnt.Core.Attributes; using NAnt.Core; namespace AdaNantTasks { [TaskName("createWebSite")] public class CreateWebsiteTask : Task { public NantLogger logger = new NantLogger(); private string m_server; [TaskAttribute("server", Required = true)]

Dump IIS info with C#

0 Comments

To call the function use:  this.DumpIISInfo(new DirectoryEntry("IIS://localhost/w3svc")); /// <summary> /// Dump iis info /// </summary> /// <returns> /// 0 = All IIS information is written to the console /// 1 = Parameter entry was null

Determine if an IIS website or IIS virtualdirectory exist, that run under a given applicationpool, with C#

0 Comments

To call this function use: DoesAppPoolHaveWebsites(new DirectoryEntry(string.Format("IIS://{0}/w3svc", "localhost")), "appPoolName")   /// <summary> /// Determine if a IIS website running under an applicationpool exists. /// </summary> /// <returns></returns> public bool DoesAppPoolHaveWebsites(DirectoryEntry iisEntry, string appPoolName) { bool

How to list all IIS applicationpools and properties, with C#

0 Comments

/// <summary> /// List all properties of an IIS applicationpool /// </summary> /// <param name="serverName">Name of the IIS server e.g. localhost</param> /// <param name="appPoolName">Name of the applicationpool e.g. test</param> public void ListAppPoolProperties(string serverName, string appPoolName)

How to determine if an IIS website contains virtualdirectories, with C#

0 Comments

/// <summary> /// Does the given IIS website contain virtualdirectories. /// </summary> /// <returns></returns> public bool DoesWebsiteContainVirtualDirectories(string website) { if (string.IsNullOrEmpty(website)) { throw new Exception("Parameter [website] can't be null or empty"); } bool result =

List all properties of a IIS website, with C#

0 Comments

/// <summary> /// List all properties of a IIS website /// </summary> /// <param name="serverName">Name of the IIS server e.g. localhost</param> /// <param name="websiteName">Name of the website e.g. test</param> public void ListWebsiteProperties(string serverName, string websiteName)

Get or set the filesystem folder (path) for a IIS website, with C#

0 Comments

/// <summary> /// Get the filesystem folder for the given website /// </summary> /// <param name="serverName">Name of the IIS server e.g. localhost</param> /// <param name="websiteName">Name of the website e.g. test</param> /// <returns>filesystem folder or empty

Get IIS website id on website name, with C#

0 Comments

/// <summary> /// Get website id on websitename /// </summary> /// <param name="serverName">Name of the IIS server e.g. localhost</param> /// <param name="websiteName">Name of the website e.g. test</param> /// <returns> /// Less the 0, site does

Check if an IIS website exists with C#

2 Comments

/// <summary> /// Check if a website on the given server exist. /// Check on websitename (ServerComment) is case insensitive. /// </summary> /// <param name="serverName">Name of the IIS server e.g. localhost</param> /// <param name="websiteName">Name of