How to pass multiple variables to a link/href without having to open the browser using VBScript? The goal is to save/insert/update depending on the parameters that was passed on the URL, and the IIS Webserver would have to do the database change instead of the VBScript. The VBScript runs on schedule and would not want to open browser on the server each time it is executed.
My VBS code below:
Function HTMLEncode(Text)
Dim i
Dim acode
Dim repl
HTMLEncode = Text
For i = Len(HTMLEncode) To 1 Step -1
acode = Asc(Mid(HTMLEncode, i, 1))
Select Case acode
Case 32
repl = " "
Case 34
repl = """
Case 38
repl = "&"
Case 60
repl = "<"
Case 62
repl = ">"
Case acode => 32 AND acode <= 127
' don't touch alphanumeric chars
Case Else
repl = "&#" & CStr(acode) & ";"
End Select
If Len(repl) Then
HTMLEncode = Left(HTMLEncode, i - 1) & repl & Mid(HTMLEncode,+ 1)
repl = ""
End If
Next
End Function
strBody = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & _
"<html>" & _
"<head>" & _
"<title>TEST</title>" & _
"</head>" & _
"<body bgcolor=""#FFFFFF"">" & _
"<p> The user bla bla bla </p>" & _
"<p><b> " & _
"<br><br><br><br> This message is sent from an un-monitored mailbox, please do not reply. " & _
"</p>" & _
"</body>" & _
"</html>"
strBody = HTMLEncode(strBody)
myURL = "http://www.test.com/sendmail.asp?body=" & strBody
Set req = CreateObject("MSXML2.XMLHTTP.6.0")
req.Open "GET", myURL, False
req.Send