Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can somebody please tell me how to set and get the connection string from web.config in classic asp.

Thanks in advance

What I have tried:

Can somebody please tell me how to set and get the connection string from web.config in classic asp.
Posted
Updated 16-Aug-16 1:52am

 
Share this answer
 
May try this for your code:

But this is spoon feed have you tried Google. You need to iterate through the nodes in web.config.

C#
set xmlDoc=server.CreateObject("Microsoft.XMLDOM")
set xmlappSettings=server.CreateObject("Microsoft.XMLDOM")
set xmladd=server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load(server.MapPath ("web.config"))
set xmlappSettings = xmldoc.GetElementsByTagName("appSettings").Item(0) 
set xmladd = xmlappSettings.GetElementsByTagName("add")
for each x in xmladd 
'Check for the Atrribute Value
if  x.getAttribute("key") ="ConnectionString1" then
Response.write(x.getAttribute("value"))
end if
next
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900