Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Active Server Pages error 'ASP 0115'

Hello All,

I've got a website, that normally works fine, that said occasionally it throughs a glitch on a particular page, leading the advertised to think an error has occured and repost, when i tested this with friendly error messages off, I got the following error message -
"
Active Server Pages error 'ASP 0115'
Unexpected error
/employer/aftervacancyposted.asp
A trappable error (C0000005) occurred in an external object. The script cannot continue running."

I've done a little research and from what I can see it is an error occurs randomly??  With this in mind, what I would like to do is in the event that the error occurs, the user is redirected to an alternative page without realising that an error has occured?

Is this possible?
My code is below -

Thank you
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/recruta2.asp" -->
<!--#include file="../ScriptLibrary/incSmartMailer.asp" -->
<%
On Error resume Next
%><%
Dim VACANCY__MMColParam
VACANCY__MMColParam = "0"
If (Session("NEWVACANCY") <> "") Then 
  VACANCY__MMColParam = Session("NEWVACANCY")
End If
%>
<%
Dim VACANCY__MMColParam2
VACANCY__MMColParam2 = "0"
If (Session("EMPLOYEEID") <> "") Then 
  VACANCY__MMColParam2 = Session("EMPLOYEEID")
End If
%>
<%
Dim VACANCY__MMColParam3
VACANCY__MMColParam3 = "0"
If (Session("SITEID") <> "") Then 
  VACANCY__MMColParam3 = Session("SITEID")
End If
%>
<%
Dim VACANCY
Dim VACANCY_cmd
Dim VACANCY_numRows
 
Set VACANCY_cmd = Server.CreateObject ("ADODB.Command")
VACANCY_cmd.ActiveConnection = MM_recruta2_STRING
VACANCY_cmd.CommandText = "SELECT JBAID, JBAEmployeeID, JBASiteID, JBATitle, JBADatePosted, JBADescription, JBAPayRate, JBALocation, JBAEmplymentType, JBAReference, JBAConkersEmail FROM dbo.JBAdvert WHERE JBATitle = ? AND JBAEmployeeID = ? AND JBASiteID = ? AND JBADatePosted BETWEEN DATEADD(mi, -3, GETDATE()) AND GETDATE()" 
VACANCY_cmd.Prepared = true
VACANCY_cmd.Parameters.Append VACANCY_cmd.CreateParameter("param1", 200, 1, 255, VACANCY__MMColParam) ' adVarChar
VACANCY_cmd.Parameters.Append VACANCY_cmd.CreateParameter("param2", 5, 1, -1, VACANCY__MMColParam2) ' adDouble
VACANCY_cmd.Parameters.Append VACANCY_cmd.CreateParameter("param3", 5, 1, -1, VACANCY__MMColParam3) ' adDouble
 
Set VACANCY = VACANCY_cmd.Execute
VACANCY_numRows = 0
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "0"
If (Session("SITEID")  <> "") Then 
  Recordset1__MMColParam = Session("SITEID") 
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
 
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_recruta2_STRING
Recordset1_cmd.CommandText = "SELECT JBSSiteID, JBSMetaTitle, JBSLogo, JBSMetaKeywords, JBSMetaDescription, JBSHomePageText, JBSURL, JBSURLShort, JBSNoReplyEmail FROM dbo.JBSite WHERE JBSSiteID = ?" 
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDouble
 
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim USERS__MMColParam
USERS__MMColParam = "0"
If (Session("SITEID")  <> "") Then 
  USERS__MMColParam = Session("SITEID") 
End If
%>
<%
Dim USERS__MMColParam2
USERS__MMColParam2 = "%"
If (Session("NEWVACANCYLOCATION")  <> "") Then 
  USERS__MMColParam2 = Session("NEWVACANCYLOCATION") 
End If
%>
<%
Dim USERS__MMColParam3
USERS__MMColParam3 = "%"
If (Session("NEWVACANCYCATEGORY")   <> "") Then 
  USERS__MMColParam3 = Session("NEWVACANCYCATEGORY")  
End If
%>
<%
Dim USERS__MMColParam4
USERS__MMColParam4 = "%"
If (Session("NEWVACANCYDESCRIPTION")   <> "") Then 
  USERS__MMColParam4 = Session("NEWVACANCYDESCRIPTION")  
End If
%>
<%
Dim USERS
Dim USERS_cmd
Dim USERS_numRows
 
Set USERS_cmd = Server.CreateObject ("ADODB.Command")
USERS_cmd.ActiveConnection = MM_recruta2_STRING
USERS_cmd.CommandText = "SELECT * FROM dbo.JBEmailNotification WHERE JBENsiteID = ? AND JBENlocation = ? AND JBENcategory = ? AND ? like '%' + JBENKeyword + '%'" 
USERS_cmd.Prepared = true
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param1", 5, 1, -1, USERS__MMColParam) ' adDouble
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param2", 200, 1, 255, USERS__MMColParam2) ' adVarChar
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param3", 200, 1, 255, USERS__MMColParam3) ' adVarChar
USERS_cmd.Parameters.Append USERS_cmd.CreateParameter("param4", 200, 1, 4000, USERS__MMColParam4) ' adVarChar
 
Set USERS = USERS_cmd.Execute
USERS_numRows = 0
%>
<%
' Smart Mailer 1.0.7
' Send on load
Server.ScriptTimeout = 300
Set sm2 = new SmartMailer
sm2.checkVersion "1.07"
sm2.contentCharset = "iso-8859-1"
Session.CodePage = sm2.getCodepage()
sm2.smtpSetup "", "", "", ""
sm2.pickup = ""
sm2.component = "cdo"
sm2.tmpFolder = ""
sm2.embedImages = false
sm2.progressBar = ""
sm2.ignore_errors = true
sm2.useQueue = false
sm2.setFrom Recordset1.Fields.Item("JBSURLShort").Value, Recordset1.Fields.Item("JBSNoReplyEmail").Value
sm2.setTo Session("EMPLOYEENAME"), Session("EMPLOYEEUSERNAME")
sm2.setCc "", ""
sm2.setBcc "", ""
sm2.Subject = "Vacancy title " & (VACANCY.Fields.Item("JBATitle").Value) & " posted on " & (Recordset1.Fields.Item("JBSURLShort").Value) & ""
' using static for body
sm2.setBody_Static_text "Dear " & (Session("EMPLOYEENAME")) & "," & vbCRLF & "" & vbCRLF & "Your vacancy titled " & (VACANCY.Fields.Item("JBATitle").Value) & " has successfully been posted on " & (Recordset1.Fields.Item("JBSURLShort").Value) & "" & vbCRLF & "" & vbCRLF & "Kind regards"
' Attachments none
sm2.sendMail "one"
%>
<%
' Smart Mailer 1.0.7
' Send on load
Server.ScriptTimeout = 300
Set sm1 = new SmartMailer
sm1.checkVersion "1.07"
sm1.contentCharset = "iso-8859-1"
Session.CodePage = sm1.getCodepage()
sm1.smtpSetup "", "", "", ""
sm1.pickup = ""
sm1.component = "cdo"
sm1.tmpFolder = ""
sm1.embedImages = true
sm1.progressBar = ""
sm1.ignore_errors = true
sm1.useQueue = false
sm1.setFrom Recordset1.Fields.Item("JBSURLShort").Value, Recordset1.Fields.Item("JBSNoReplyEmail").Value
Set sm1.toRecord = USERS
sm1.toRecordName = "JBENname"
sm1.toRecordEmail = "JBENusername"
sm1.total_mail = sm1.getTotalRecords(USERS)
while not sm1.toRecord.EOF
  sm1.setTo sm1.toRecord.Fields.Item(sm1.toRecordName).Value, sm1.toRecord.Fields.Item(sm1.toRecordEmail).Value
  sm1.Subject = "" & (VACANCY.Fields.Item("JBATitle").Value) & " advertised on " & (Recordset1.Fields.Item("JBSURLShort").Value) & ""
  ' using template for body
  sm1.setBody_Template_html "vacancynotification.asp?ID=" & (VACANCY.Fields.Item("JBAID").Value) & ""
  ' Attachments none
  sm1.sendMail "multiple"
  USERS.MoveNext()
Wend
sm1.done()
Response.Redirect "aftervacancyposted2.asp"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>vacancy posted</title>
</head>
 
<body>
</body>
</html>
<%
VACANCY.Close()
Set VACANCY = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
USERS.Close()
Set USERS = Nothing
%>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of sunithnair
sunithnair

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

OK I guess the real question here should be, can anyone see what is causing the error to occur?
 
Many thanks