Johnnie100
Programmer
I've got a class in ASP and instantiate an object with it. Within the class is no error handling as yet. I understand that VBScript error handling is similar to that in VB - I have tried using the same sort of error handling but am getting a syntax error.
Any help would be gratefully appreciated. The code is;
Public Function GetURL(ByRef pStrURL)
'Variables
Dim lObjSpider
Dim strText
'Return if no URL has been passed
If pStrURL = "" Then Exit Function
'On Error Resume Next
'Create spider object
Set lObjSpider = Server.CreateObject ("Microsoft.XMLHTTP"
' Could not create Internet Control
If Err Then
GetURL = "Error: " & Err.Description
Exit Function
End If
'On Error Goto 0
On Error Goto Error_Handler
With lObjSpider
.Open "GET", pStrURL, False, "", ""
.Send
GetURL = .ResponseText
End With
Set LobjSpider = Nothing
'strHTML = GetURL
RetrievedstrHTML = "Andy tester text"
'Return
Exit Function
'Error handling
Error_Handler:
GetURL=""
End Function
Any help would be gratefully appreciated. The code is;
Public Function GetURL(ByRef pStrURL)
'Variables
Dim lObjSpider
Dim strText
'Return if no URL has been passed
If pStrURL = "" Then Exit Function
'On Error Resume Next
'Create spider object
Set lObjSpider = Server.CreateObject ("Microsoft.XMLHTTP"
' Could not create Internet Control
If Err Then
GetURL = "Error: " & Err.Description
Exit Function
End If
'On Error Goto 0
On Error Goto Error_Handler
With lObjSpider
.Open "GET", pStrURL, False, "", ""
.Send
GetURL = .ResponseText
End With
Set LobjSpider = Nothing
'strHTML = GetURL
RetrievedstrHTML = "Andy tester text"
'Return
Exit Function
'Error handling
Error_Handler:
GetURL=""
End Function