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
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