Running custom VbScript code from asp
I was in the need to run some custom VbScript code from an asp page, so I went through the problem and found a very simple solution.
A common solution is to use the Microsoft ScriptControl.
Here is a very simple example running a piece of code stored in a text file.
dim sFile : sFile = ""
sFile = LoadFile("MyCustomScript.txt")
if len(sFile) > 0 then
Response.Write "The result is: " & ExecScript(sFile)
'Create the Script Control object
set sc = server.CreateObject("scriptcontrol")
sc.Language = "VBSCRIPT"
sc.UseSafeSubset = false
'add the custom script to...