Active Server Pages error 'ASP 0113'

The following scripts, occasionally result in the following error -
"Active Server Pages error 'ASP 0113'
Script timed out
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools. "

emregister.asp  is a page that runs a series of Stored Procedures, firstly it validates some details, then it does an insert, then it returns data spewcific to the new insert before finally sending three emails.-

Nothing to difficult, yet occasionally I get the above message, is there something wrong with my code (either ASP or MS SQL)?

Thank you.

<!--#include file="../Connections/recruta2.asp" -->
Dim SiteDetail__MMColParam
SiteDetail__MMColParam = "0"
If (Session("SITEID") <> "") Then 
  SiteDetail__MMColParam = Session("SITEID")
End If
Dim SiteDetail
Dim SiteDetail_cmd
Dim SiteDetail_numRows

Set SiteDetail_cmd = Server.CreateObject ("ADODB.Command")
SiteDetail_cmd.ActiveConnection = MM_recruta2_STRING
SiteDetail_cmd.CommandText = "SELECT JBSURLShort, JBSURL, JBSNoReplyEmail, JBSEmail FROM dbo.JBSite WHERE JBSSiteID = ?" 
SiteDetail_cmd.Prepared = true
SiteDetail_cmd.Parameters.Append SiteDetail_cmd.CreateParameter("param1", 5, 1, -1, SiteDetail__MMColParam) ' adDouble

Set SiteDetail = SiteDetail_cmd.Execute
SiteDetail_numRows = 0


Dim usercheck__SiteID
usercheck__SiteID = "0"
if(Session("SITEID") <> "") then usercheck__SiteID = Session("SITEID")

Dim usercheck__Username
usercheck__Username = "0"
if(Request.Form("username") <> "") then usercheck__Username = Request.Form("username")


set usercheck = Server.CreateObject("ADODB.Command")
usercheck.ActiveConnection = MM_recruta2_STRING
usercheck.CommandText = "dbo.jobboardemployercheckusername"
usercheck.CommandType = 4
usercheck.CommandTimeout = 0
usercheck.Prepared = true
usercheck.Parameters.Append usercheck.CreateParameter("@RETURN_VALUE", 3, 4)
usercheck.Parameters.Append usercheck.CreateParameter("@SiteID", 3, 1,5,usercheck__SiteID)
usercheck.Parameters.Append usercheck.CreateParameter("@Username", 200, 1,225,usercheck__Username)
set loginexists = usercheck.Execute
loginexists_numRows = 0

<% If Not loginexists.EOF Then Response.Redirect "../emregister.asp?pass=e&JS=" & Request.Form("username")& "" End if %>

Dim newemployer__siteid
newemployer__siteid = "0"
if(Session("SITEID") <> "") then newemployer__siteid = Session("SITEID")

Dim newemployer__companyname
newemployer__companyname = "0"
if(Request.Form("firstname") <> "") then newemployer__companyname = Request.Form("firstname")

Dim newemployer__address
newemployer__address = "0"
if(Request.Form("address") <> "") then newemployer__address = Request.Form("address")

Dim newemployer__phone
newemployer__phone = "0"
if(Request.Form("phone") <> "") then newemployer__phone = Request.Form("phone")

Dim newemployer__url
newemployer__url = "0"
if(Request.Form("url") <> "") then newemployer__url = Request.Form("url")

Dim newemployer__companytype
newemployer__companytype = "0"
if(Request.Form("ctype") <> "") then newemployer__companytype = Request.Form("ctype")

Dim newemployer__AccountType
newemployer__AccountType = "0"
if(Request.Form("atype") <> "") then newemployer__AccountType = Request.Form("atype")

Dim newemployer__billingcontact
newemployer__billingcontact = "0"
if(Request.Form("billingcontact") <> "") then newemployer__billingcontact = Request.Form("billingcontact")

Dim newemployer__name
newemployer__name = "0"
if(Request.Form("name") <> "") then newemployer__name = Request.Form("name")

Dim newemployer__email
newemployer__email = "0"
if(Request.Form("username") <> "") then newemployer__email = Request.Form("username")

Dim newemployer__password
newemployer__password = "0"
if(Request.Form("password") <> "") then newemployer__password = Request.Form("password")


set newemployer = Server.CreateObject("ADODB.Command")
newemployer.ActiveConnection = MM_recruta2_STRING
newemployer.CommandText = "dbo.jobboardemployerregister"
newemployer.CommandType = 4
newemployer.CommandTimeout = 0
newemployer.Prepared = true
newemployer.Parameters.Append newemployer.CreateParameter("@RETURN_VALUE", 3, 4)
newemployer.Parameters.Append newemployer.CreateParameter("@siteid", 3, 1,5,newemployer__siteid)
newemployer.Parameters.Append newemployer.CreateParameter("@companyname", 200, 1,50,newemployer__companyname)
newemployer.Parameters.Append newemployer.CreateParameter("@address", 200, 1,500,newemployer__address)
newemployer.Parameters.Append newemployer.CreateParameter("@phone", 200, 1,50,newemployer__phone)
newemployer.Parameters.Append newemployer.CreateParameter("@url", 200, 1,225,newemployer__url)
newemployer.Parameters.Append newemployer.CreateParameter("@companytype", 200, 1,1,newemployer__companytype)
newemployer.Parameters.Append newemployer.CreateParameter("@AccountType", 200, 1,1,newemployer__AccountType)
newemployer.Parameters.Append newemployer.CreateParameter("@billingcontact", 200, 1,50,newemployer__billingcontact)
newemployer.Parameters.Append newemployer.CreateParameter("@name", 200, 1,50,newemployer__name)
newemployer.Parameters.Append newemployer.CreateParameter("@email", 200, 1,225,newemployer__email)
newemployer.Parameters.Append newemployer.CreateParameter("@password", 200, 1,50,newemployer__password)


Dim userlogin__SiteID
userlogin__SiteID = "0"
if(Session("SITEID") <> "") then userlogin__SiteID = Session("SITEID")

Dim userlogin__Username
userlogin__Username = "0"
if(Request.Form("username") <> "") then userlogin__Username = Request.Form("username")


set userlogin = Server.CreateObject("ADODB.Command")
userlogin.ActiveConnection = MM_recruta2_STRING
userlogin.CommandText = "dbo.jobboardemployerlogin2"
userlogin.CommandType = 4
userlogin.CommandTimeout = 0
userlogin.Prepared = true
userlogin.Parameters.Append userlogin.CreateParameter("@RETURN_VALUE", 3, 4)
userlogin.Parameters.Append userlogin.CreateParameter("@SiteID", 3, 1,5,userlogin__SiteID)
userlogin.Parameters.Append userlogin.CreateParameter("@Username", 200, 1,225,userlogin__Username)
set jsdetail = userlogin.Execute
jsdetail_numRows = 0

<% If Not jsdetail.EOF Then 
     Session("SITEID") = jsdetail.Fields("JBESiteID") 
     Session("EMPLOYEEID") = jsdetail.Fields("JBEID") 
     Session("EMPLOYERID") = jsdetail.Fields("JBEClientID") 
     Session("EMPLOYEENAME") = jsdetail.Fields("JBEName") 
     Session("EMPLOYEEUSERNAME") = jsdetail.Fields("JBEUsername")
End If
<% if Request.Form("atype") = "a" then 
Set myMail=CreateObject("CDO.Message")
URLLong= (SiteDetail("JBSURL")) & "/coms/em/tkregisterthankyou.asp?ID=" & jsdetail.Fields("JBEID")
myMail.Subject= "Thank you for registering with  " & URLShort
myMail.From= ReplyMail
myMail.To= ToMail
myMail.CreateMHTMLBody URLLong
set myMail=nothing
End If
<% if Request.Form("atype") = "m" then 
Set myMail=CreateObject("CDO.Message")
URLLong= (SiteDetail("JBSURL")) & "/coms/em/acregisterthankyou.asp?ID=" & jsdetail.Fields("JBEID")
myMail.Subject= "Thank you for registering with  " & URLShort
myMail.From= ReplyMail
myMail.To= ToMail
myMail.CreateMHTMLBody URLLong
set myMail=nothing
End If
<% Set myMailCli=CreateObject("CDO.Message")
URLLong= (SiteDetail("JBSURL")) & "/coms/wm/newclient.asp?ID=" & jsdetail.Fields("JBEID")
myMailCli.Subject= "New Client Registration on  " & URLShort
myMailCli.From= ReplyMail
myMailCli.To= ToMail
myMailCli.CreateMHTMLBody URLLong
set myMailCli=nothing
<% Response.Redirect "/em/default.asp?RID=" & Request.Form("atype")%>
Set SiteDetail = Nothing

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
>>Nothing to difficult, yet occasionally I get the above message, is there something wrong with my code (either ASP or MS SQL)?

I would check several things:

1. Check whether got record inserted into your database?

2. That's a possibility that your SMTP caused the problem.

So, it's suggested to remark part of your scripts to do the debuging..
Om PrakashCommented:
Add script timeout on top of your page
Server.ScriptTimeout = 600

If SQL query is taking long time then you can increase command time out
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionTimeout = 120
conn.Open <connectionString>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

There is a lot of processing happening at your page. Try to skip some code if it possible..

else increase script timeout like this

Server.ScriptTimeout =1800 ' or more... if you like

the reason of this occasional issue could be fluctuating IIS and database server load..
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

garethtnashAuthor Commented:
Hello All,
 Thanks for all of your responses.
The websites that run these scripts are all running on our own servers, would changing the server script timeout not have an impact on the servers speed in general?
I guess that I need to break down and test each of the scripts one by one, to try and work out, which is the problem script?
Neeraj523, please could you explain your last line in a little more detail, the line -
"could be fluctuating IIS and database server load.."
thank you
Om PrakashCommented:
You can change script timeout for individual pages where you are facing timeout issues.

I referred to sudden surge in IIS or database load which may be giving you timeout error at a page which otherwise works fine..

So increasing script timeout is one way to debug this problem. Check if script still gets timed out after increasing timeout.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.