Solved

Active Server Pages error 'ASP 0115'

Posted on 2009-04-14
2
611 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:garethtnash
2 Comments
 
LVL 16

Accepted Solution

by:
sunithnair earned 500 total points
ID: 24136744
Yes you should be able to redirect the user if there is an error on the page. Check this link for more information http://www.15seconds.com/issue/990603.htm
0
 

Author Comment

by:garethtnash
ID: 24368380
OK I guess the real question here should be, can anyone see what is causing the error to occur?
 
Many thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CSS Question.. 3 77
show region if a selection is made on a drop down menu 3 56
Connection String to remote Server not working 3 72
Select2 jquery help 9 74
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
A short film showing how OnPage and Connectwise integration works.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now