471,071 Members | 7,743 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

direct edit of the ii6s metabase.xml using c# or vb.net


I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this
code, trying to get a list of all defined websites, and write their name to
console, but it does not seem to work, would appreciate any pointers:

-----------
Try
Dim doc As New XmlDocument
Dim nodelist As XmlNodeList
Dim node As XmlNode

'Load the Xml file
'doc.Load("c:\windows\system32\inetsrv\metabase.xm l")

'Get the list of name nodes

nodelist = doc.SelectNodes("/MBProperty/IIsWebServer")

'Loop through the nodes

For Each node In nodelist
Dim siteName =
node.Attributes.GetNamedItem("ServerComment").Valu e
Console.WriteLine("Site: " & siteName)
Next

Catch errorVariable As Exception
'Error trapping
Console.Write(errorVariable.ToString())
End Try
-----------

Here's a sample metabase.xml file:
http://www.winnetmag.com/Files/11/22281/22281.zip
Nov 12 '05 #1
1 6113
I do not recommend to edit the metabase.xml file directly. You should go
through the ADSI interface or access the IIS metabase interface via COM
interop. I haven't seen any documentation that IIS would detect changes to
the metabase and reload the configuration. It's very likely that IIS will
overwrite changes you make to the XML file.

Are you sure that this is what you want to do?
--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"Roger" <ro******@hotmail.com> wrote in message
news:#c**************@TK2MSFTNGP11.phx.gbl...

I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this code, trying to get a list of all defined websites, and write their name to console, but it does not seem to work, would appreciate any pointers:

-----------
Try
Dim doc As New XmlDocument
Dim nodelist As XmlNodeList
Dim node As XmlNode

'Load the Xml file
'doc.Load("c:\windows\system32\inetsrv\metabase.xm l")

'Get the list of name nodes

nodelist = doc.SelectNodes("/MBProperty/IIsWebServer")

'Loop through the nodes

For Each node In nodelist
Dim siteName =
node.Attributes.GetNamedItem("ServerComment").Valu e
Console.WriteLine("Site: " & siteName)
Next

Catch errorVariable As Exception
'Error trapping
Console.Write(errorVariable.ToString())
End Try
-----------

Here's a sample metabase.xml file:
http://www.winnetmag.com/Files/11/22281/22281.zip

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by David Veeneman | last post: by
reply views Thread by Will Holley | last post: by
1 post views Thread by Schemer | last post: by
2 posts views Thread by =?Utf-8?B?SmliZXkgSmFjb2I=?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.