XML Document Object woes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rowe_newsgroups

    #1

    XML Document Object woes

    Hello all,

    After deploying a project onto our network drive, I've run into a snag
    with the .NET security policies. I realize I can use the .NET
    configuration snapin to change the Machine level code groups, but doing
    this on each machine would be a nightmare due to the number of
    computers using this program. I've been experimenting with code to edit
    the XML file that holds the security settings, but this is where the
    problem lies. Using XMLDoc.save adds indentation to the xml file and
    puts all the attributes for a node onto the same line. From what I can
    tell this prevents both the application and the configuration tool from
    accessing the file. (Actually, the configuration tool will undo/restore
    any changes you have made when it opens). Any ideas you gurus can offer
    I appreciate.

    Sub Main()
    Dim XMLDoc As New XmlDocument
    Dim XMLNode As XmlNode

    XMLDoc.Load("C: \WINDOWS\Micros oft.NET\Framewo rk\v2.0.50727\C ONFIG\security. config")
    For Each XMLNode In XMLDoc.GetEleme ntsByTagName("C odeGroup")
    If XMLNode.Attribu tes("Name").Val ue = "LocalIntranet_ Zone" Then
    XMLNode.Attribu tes("Permission SetName").Value = "FullTrust"

    XMLDoc.Save("C: \WINDOWS\Micros oft.NET\Framewo rk\v2.0.50727\C ONFIG\security. config")
    Exit For
    End If
    Next
    End Sub

    Thanks,

    Seth

  • rowe_newsgroups

    #2
    Re: XML Document Object woes

    I found a usable solution - it seems I was overthinking the problem as
    the .NET security policy wouldn't allow the below code to run any way.
    It looks like I'll just have to just run a login script that executes
    the Deployment Package that I created with the .NET configuration
    wizard in order to change the Machine Level settings.

    Thanks all,

    Seth Rowe


    rowe_newsgroups wrote:
    Hello all,
    >
    After deploying a project onto our network drive, I've run into a snag
    with the .NET security policies. I realize I can use the .NET
    configuration snapin to change the Machine level code groups, but doing
    this on each machine would be a nightmare due to the number of
    computers using this program. I've been experimenting with code to edit
    the XML file that holds the security settings, but this is where the
    problem lies. Using XMLDoc.save adds indentation to the xml file and
    puts all the attributes for a node onto the same line. From what I can
    tell this prevents both the application and the configuration tool from
    accessing the file. (Actually, the configuration tool will undo/restore
    any changes you have made when it opens). Any ideas you gurus can offer
    I appreciate.
    >
    Sub Main()
    Dim XMLDoc As New XmlDocument
    Dim XMLNode As XmlNode
    >
    XMLDoc.Load("C: \WINDOWS\Micros oft.NET\Framewo rk\v2.0.50727\C ONFIG\security. config")
    For Each XMLNode In XMLDoc.GetEleme ntsByTagName("C odeGroup")
    If XMLNode.Attribu tes("Name").Val ue = "LocalIntranet_ Zone" Then
    XMLNode.Attribu tes("Permission SetName").Value = "FullTrust"
    >
    XMLDoc.Save("C: \WINDOWS\Micros oft.NET\Framewo rk\v2.0.50727\C ONFIG\security. config")
    Exit For
    End If
    Next
    End Sub
    >
    Thanks,
    >
    Seth

    Comment

    Working...