0

I define an appSettings variable by going in IIS > Server > Configuration Editor > appSettings.

enter image description here

Then I would like to read this variable from a classic asp/vbscript (not .net) page, is it something possible and how ?

Jonathan
  • 1,276
  • 10
  • 35
  • Short answer: yes. What you add there will end up in the application's `web.config` file, which simply is a XML file with a different extension. Using MSXML, this isn't that hard. There are plenty of examples for using MSXML with VBScript/Classic ASP here on SO. – Hel O'Ween May 14 '20 at 14:51
  • it is not in the application's web.config file, it's in the machine root .config file, so not sure how to access it. I need to access the same variable from many applications – Jonathan May 14 '20 at 15:02
  • All those .NET *.config files are actual XML files, be it web.config or machine.config. – Hel O'Ween May 14 '20 at 15:05
  • You may find this useful - [Feature Delegation in IIS](https://stackoverflow.com/a/12343141/692942). – user692942 May 15 '20 at 07:59
  • you could try to use this link code: https://stackoverflow.com/questions/28960446/having-classic-asp-read-in-a-key-from-appsettings-in-a-web-config-file another thing is you need to assign the iis user permission to the web config folder. – Jalpa Panchal May 15 '20 at 09:29

1 Answers1

0

As mentioned above, you could read corresponding config as a file

Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile("C:\Windows\Microsoft.NET\...\Config\machine.config", 1)
Response.Write(Server.HTMLEncode(f.ReadAll))
f.Close

to parse xml use something like this

Set objxml = Server.CreateObject("MSXML2.DOMDocument.3.0")
objxml.load("C:\Windows\Microsoft.NET\...\Config\machine.config")

Set NodeList = objxml.documentElement.selectNodes("/configuration/configSections/section")
For Each Node In NodeList
   Response.Write(Server.HTMLEncode(Node.Xml)) 
next
Set objxml = Nothing 
user2316116
  • 6,726
  • 1
  • 21
  • 35