列出一个指定网站的所有属性值
所属栏目:
winform
时间:2011-07-26 21:08
作者:狼子
//遍历所有网站,获取指定网站siteName的所有属性值
using (DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC"))
{
foreach (DirectoryEntry site in root.Children)
{
if (site.SchemaClassName.Equals("IIsWebServer"))
{
if (site.Properties["ServerComment"].Value.ToString().Equals(siteName))
{
foreach (string p in site.Properties.PropertyNames)
{
textBox1.Text += String.Format("{0} = {1},",
p,
site.Properties[p].Value.ToString());
}
}
}
}
}
所有属性项包括:
FrontPageWeb
ServerAutoStart
ServerSize
Win32Error
ServerState
DefaultDoc
KeyType
ServerComment
SecureBindings
ServerBindings
AllowKeepAlive
AppAllowClientDebug
AppAllowDebugging
AspAllowOutOfProcComponents
AspAllowSessionState
AspAppServiceFlags
AspBufferingLimit
AspBufferingOn
AspCalcLineNumber
AspCodepage
AspEnableApplicationRestart
AspEnableAspHtmlFallback
AspEnableChunkedEncoding
AspEnableParentPaths
AspEnableTypelibCache
AspErrorsToNTLog
AspExceptionCatchEnable
AspExecuteInMTA
AspKeepSessionIDSecure
AspLCID
AspLogErrorRequests
AspMaxDiskTemplateCacheFiles
AspMaxRequestEntityAllowed
AspProcessorThreadMax
AspQueueConnectionTestTime
AspQueueTimeout
AspRequestQueueMax
AspRunOnEndAnonymously
AspScriptEngineCacheMax
AspScriptErrorSentToBrowser
AspScriptFileCacheSize
AspScriptTimeout
AspSessionMax
AspSessionTimeout
AspTrackThreadingModel
AuthFlags
CacheISAPI
CGITimeout
ConnectionTimeout
ContentIndexed
DirBrowseFlags
LogExtFileFlags
LogFilePeriod
LogFileTruncateSize
LogType
MaxConnections
PasswordChangeFlags
AnonymousUserName
AnonymousUserPass
AppPoolId
AspScriptErrorMessage
AspScriptLanguage
LogOdbcDataSource
LogOdbcPassword
LogOdbcTableName
LogOdbcUserName
LogPluginClsid
AspDiskTemplateCacheDirectory
LogFileDirectory
HttpCustomHeaders
HttpErrors
ScriptMaps
MaxBandwidth
AdminACL