using System;
using System.DirectoryServices;
using System.Collections;
namespace IIS6
{
/// <summary>
/// IISWebServer的狀態
/// </summary>
public enum IISServerState
{
/// <summary>
///
/// </summary>
Starting = 1,
/// <summary>
///
/// </summary>
Started = 2,
/// <summary>
///
/// </summary>
Stopping = 3,
/// <summary>
///
/// </summary>
Stopped = 4,
/// <summary>
///
/// </summary>
Pausing = 5,
/// <summary>
///
/// </summary>
Paused = 6,
/// <summary>
///
/// </summary>
Continuing = 7
}
}
IISWebServer
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
namespace IIS6
{
/// <summary>
/// IISWebServer
/// </summary>
public class IISWebServer
{
/// <summary>
///
/// </summary>
internal int index = -1;
/// <summary>
///
/// </summary>
public IISWebVirtualDirCollection WebVirtualDirs;
/// <summary>
/// 網站說明
/// </summary>
public string ServerComment = "Way";
/// <summary>
/// 腳本支持
/// </summary>
public bool AccessScript = true;
/// <summary>
/// 讀取
/// </summary>
public bool AccessRead = true;
/// <summary>
/// 物理路徑
/// </summary>
public string Path = @"c:";
/// <summary>
/// 端口
/// </summary>
public int Port = 80;
/// <summary>
/// 目錄浏覽
/// </summary>
public bool EnableDirBrowsing = false;
/// <summary>
/// 默認文檔
/// </summary>
public string DefaultDoc = "index.aspx";
/// <summary>
/// 使用默認文檔
/// </summary>
public bool EnableDefaultDoc = true;
/// <summary>
/// IISWebServer的狀態
/// </summary>
public IISServerState ServerState
{
get
{
DirectoryEntry server = IISManagement.returnIISWebserver(this.index);
if (server == null)
throw (new Exception("找不到此IISWebServer"));
switch (server.Properties["ServerState"][0].ToString())
{
case "2":
return IISServerState.Started;
case "4":
return IISSe