XML Document Object woes

  • Thread starter rowe_newsgroups
  • Start date
R

rowe_newsgroups

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\Microsoft.NET\Framework\v2.0.50727\CONFIG\security.config")
For Each XMLNode In XMLDoc.GetElementsByTagName("CodeGroup")
If XMLNode.Attributes("Name").Value = "LocalIntranet_Zone" Then
XMLNode.Attributes("PermissionSetName").Value = "FullTrust"

XMLDoc.Save("C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\security.config")
Exit For
End If
Next
End Sub

Thanks,

Seth
 
R

rowe_newsgroups

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top