![]() |
|
|||||||
| ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum? |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi guys,
after executing the following script in order to find and replace certain value in web.config, the value in the file is not being modified! "WScript.Echo "ORIGINAL VALUE: " & orig_val.value" outputs the current value correctly, i.e. I do approach the value as should... Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Set ConfigDoc = CreateObject("Msxml2.DOMDocument.3.0") ConfigDoc.async = False ConfigDoc.preserveWhiteSpace = True Dim strXMLFile strXMLFile = "C:\web.config" ' If the file is Read-Only 'then change that in order to edit Set f = objFSO.GetFile(strXMLFile) IF f.attributes and 1 Then f.attributes = f.attributes - 1 End IF IF ConfigDoc.Load(strXMLFile) Then ConfigDoc.setProperty "SelectionLanguage", "XPath" Set AppSettings = ConfigDoc.selectSingleNode("configuration/appSettings") IF Not AppSettings Is Nothing Then Set orig_val = AppSettings.selectSingleNode("add[@key = 'MyKey']/@value") IF Not orig_val Is Nothing Then WScript.Echo "ORIGINAL VALUE: " & orig_val.value orig_val.value = "NewVal" End IF End if End if can you please help , since I am lost :-( Thanks in advance Ana |
|
This ad is part of our Revenue Sharing program |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Vbscript - Regular Expression to find and replace data with an exclude parameter | DeeCee3ee | ASP & VBScript Forum | 0 | 07-21-2008 07:11 PM |