Welcome to WebmasterWorld Guest from 35.173.48.224

Forum Moderators: ocean10000

Message Too Old, No Replies

Reading web.config through script

Reading web.config through script

     
7:09 pm on Sep 18, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 18, 2009
posts: 2
votes: 0


Hi

I am trying to read the web.config through vbscript and trying edit the values of the web.config through vbscript again, but I am not to read and write the values, below is the piece of code, can some one please help

Thank you

Sathish Kumar D

X = MsgBox(" Do you want to update the current version of Portfolio in XLeRate?",vbYesNo)
If X = vbYes Then

XLeRateVersionNO = InputBox("Enter the XLeRate Version no. in which you want to update the Portfolio version")

ConfigFilePath = ServerPath1 & "\PricingSystme\XLeRate\"& XLeRateVersionNo &"\XLeRateServer\web.config"
LogToFile(ServerPath1 & "\PricingSystme\XLeRate\"& XLeRateVersionNo &"\XLeRateServer\web.config")


Set objXML = CreateObject("MSXML2.DOMDocument")
objXML.Async = False
objXML.Load(ConfigFilePath)


Set node = objXML.documentElement.selectSingleNode("/configuration/WCFServiceClient/ApplicationInformation/Applications/Application/Environments/Environment/Address")

' If node is nothing Then
' LogToFile("PortfolioService does not exist")
' Else
node = PortfolioURL
'End If

objXML.Save ServerPath1 & "\PricingSystme\XLeRate\"& XLeRateVersionNo &"\XLeRateServer\web.config"

Else

LogToFile("We are not updating the RefData with new Portfolio Version")

End if
End if

1:12 am on Sept 19, 2009 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


I think if I understand your question. Is that if the portion of the webconfig doesn't exist you do nothing. And you will only update the web.config if you find it has a value you wish to change.

And welcome to WebmasterWorld.

[Code below]
If node is nothing Then
'Do Nothing Node Doesn't Exist
Else
'Replace node with updated Node Information.
'
'Update Node Code Goes Here

'Only need to save it if there is a change I assume.
objXML.Save ServerPath1 & "\PricingSystme\XLeRate\"& XLeRateVersionNo &"\XLeRateServer\web.config"
End If

5:32 pm on Sept 21, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 18, 2009
posts: 2
votes: 0


Yes absolutely you are correct, I want to edit url which is inside the web.config, whenever I do a release for other application, hope you understands now