Updating the configuration file using classic ASP

I have a configuration file that I would like to update using classic asp.

Suppose the conf file looks like this:

[Parameters]
param1 = 'foo'
param2 = 'boo'
param3 = 'moo'
param4 = 'choo'

What would you like to do is write a script, to change param2and param4to different.

As I'm not so good with asp, I was wondering what would be the best way to do this? those. Is there a way that I can increase the line and look for param2and param4, and then somehow replace the entire line?

Any help would be greatly appreciated.

+3
source share
1 answer

, , - , , , , .

Dim fs : Set fs = Server.CreateObject("Scripting.FileSystemObject")
Dim file : Set file = fs.OpenTextFile(Server.MapPath("file.config"))
Dim line
Do While Not fs.AtEndOfStream
     line = file.ReadLine()
     If IsThisTheLineIWant(line) Then
         ' some magic
     Else
         ' some hand waving
     End If
Loop
+3

Source: https://habr.com/ru/post/1725238/


All Articles