Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/05/2005, 10:19
Avatar de RootK
RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 23 años
Puntos: 50
Puedes hacerlo así:

vb.net
Cita:
Dim sConfigFile = Server.MapPath("Web.Config")
Dim doc As XmlDocument = New XmlDocument

doc.Load(sconfigfile)

Dim nodes As XmlNodeList = doc.SelectNodes("/configuration/system.web/authorization/allow")

For Each node As XmlNode In nodes
If Not node.Attributes("roles") Is Nothing Then
node.Attributes("roles").Value = node.Attributes("roles").Value + "otra"
End If
Next

doc.Save(sConfigFile)
c#
Cita:
string sConfigFile = Server.MapPath("Web.Config");
XmlDocument doc = new XmlDocument();
doc.Load(sConfigFile);
XmlNodeList nodes = doc.SelectNodes("/configuration/system.web/authorization/allow");
foreach(XmlNode node in nodes){
if (node.Attributes["roles"] != null)
node.Attributes["roles"].Value = node.Attributes["roles"].Value + "otroRol";
}

doc.Save(sConfigFile);
Espero que te sirva.

PD.- Recuerda que el usuario asp.net tenga los permisos para escribir en el directorio virtual..

Salu2
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net