|
-
Nov 18th, 2009, 02:40 PM
#1
Thread Starter
Lively Member
HAND PLZ :Script timed out
Active Server Pages error 'ASP 0113'
Script timed out
/nkkin3/send.asp
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.
-
Nov 18th, 2009, 02:45 PM
#2
Re: HAND PLZ :Script timed out
You can increase the ScriptTimeOut from IIS administrative tools. But the better way is to optimize the code in question that is taking so much time to execute, unless your server is under heavy load.
-
Nov 18th, 2009, 02:46 PM
#3
Re: HAND PLZ :Script timed out
Can you post the code that is causing this script timeout? Maybe we would be able to help you optimize it.
-
Nov 18th, 2009, 03:04 PM
#4
Thread Starter
Lively Member
Re: HAND PLZ :Script timed out
thank you for interesting
<% If Session("project1_status") <> "login" Then Response.Redirect "admin.asp" %>
<!--#include file="header1.asp" -->
<div id="ContentHead"><b>Ajouter Actue:.</b></div>
<div id="Content"><center><br>
<!--#include file="connection.asp"-->
<!--#include file="dbnews.asp"-->
<%
add_dat=now()
section=request.form("section")
subject=request.form("subject")
subject= Replace(subject,"'","'")
subject= Replace(subject,"<","")
subject= Replace(subject,">","")
subject= Replace(subject,"é","é")
subject= Replace(subject,"è","è")
subject= Replace(subject,"â","â")
subject= Replace(subject,"û","û")
subject= Replace(subject,"î","î")
subject= Replace(subject,"ô","ô")
subject= Replace(subject,"à","à")
body=request.form("body")
body= Replace(body,"<img src='image url ici'width='550'></img><br>","")
body= Replace(body,"'","'")
body= Replace(body,"é","é")
body= Replace(body,"è","è")
body= Replace(body,"â","â")
body= Replace(body,"û","û")
body= Replace(body,"î","î")
body= Replace(body,"ô","ô")
body= Replace(body,"à","à")
photo=request.form("photo")
photo= Replace(photo,"'","'")
photo= Replace(photo,"é","é")
photo= Replace(photo,"è","è")
photo= Replace(photo,"â","â")
photo= Replace(photo,"û","û")
photo= Replace(photo,"î","î")
photo= Replace(photo,"ô","ô")
photo= Replace(photo,"à","à")
If subject="" or body="" or photo="" then
response.write "<font color=#ff8040>Please..vous devez remplir tous les champs</font><br>"
Else
addSQL= " insert into "§ion&" ([subject],[body],[add_dat],[photo]) values ('"&subject&"','"&body&"','"&add_dat&"','"&photo&"')"
ADO.execute(addSQL)
response.write "<center><b><font color=#ff8040>" & "THANK YOU... L'information est bien ajoutée</font>"
Set ADO = Server.CreateObject("ADODB.Connection")
ADO.Open xDb_Conn_Str
strsql = "SELECT * FROM [emails]"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, ADO
recActual = 0
Do While (NOT rs.EOF)
recCount = recCount + 1
on error resume next
Set oMail =CreateObject("CDO.Message")
oMail.From = "www.nkkin-web.co.cc"
oMail.To = rs("Email")
oMail.Subject = "Nkkin-web:" & subject
oMail.BodyPart.charset = "unicode-1-1-utf-8"
oMail.BodyPart.ContentTransferEncoding = "quoted-printable"
oMail.HTMLBody = "<html><body bgcolor='#000000'><a href=http://users1.jabry.com/nkkin3 target=_blank><img src=http://users1.jabry.com/nkkin3/Files/Images/90x940Header.jpg></img></a><br><font color=#800000 size=4><b><center>" & subject & "</b></font></center><br /><font color=#000000 size=2><center><b>" & body & "</b><br /></font></center><br></body></html>"
oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxxxxxxxxxxxxxxxxxxx"
oMail.Configuration.Fields.Update
oMail.Send
set oMail=nothing
rs.MoveNext
Loop
End If
%>
<form method="POST" action="add_news.asp">
<table border="0"width="100%"color="#446677">
<tr><td width=20% bgcolor="#334466">
<p><b><center><font color="#800000"> TYPE:</font></center></td><td width=80%> <select size="1" name="section"class='tbox'>
<option value="news_news"> Actue générale </option>
<option value="amazigh_news"> Actue amazigh </option>
<option value="sport_news"> Actue sport </option>
</select></b></p></td></tr><tr><td width=20% bgcolor="#334466">
<p><b> <center><font color="#800000">subject:</font></center></td><td> <input type="text" name="subject"size="50"class='tbox'></b></p></td></tr><tr><td width=20% bgcolor="#334466">
<p><b><center><font color="#800000"> Photo url:</font> </center></td><td><input type="text" name="photo"size="50"class='tbox'></b></p></td></tr><tr><td width=20% bgcolor="#334466">
<p><b> <center><font color="#800000">body:</font></center></b></p></td><td><p><b> <textarea rows="6" name="body" cols="50"class='tbox'><img src='image url ici'width='550'></img><br></textarea></b></p></td></tr>
<tr><td> </span></td><td><p><input type="submit" value=" Add " name="add"class='button'><span lang="en-us"> <input type="reset" value=" Reset " name="reset"class='button'></p></span></td></tr></table></form><br>
</div>
<!--#include file="footer.asp" -->
-
Nov 18th, 2009, 03:26 PM
#5
Re: HAND PLZ :Script timed out
Okk... I see. So you are sending emails to many recipients.
Here are a few suggestions to optimize the code:
1. Close the ADO recordset and connection objects when you are done with the processing.
2. Since you are sending the email to all recipients one by one, it might be taking too much time if the list is long. Instead, send the email to yourself and BCC to maximum number of recipients possible in one go. e.g. If the server allows 50 recipients in one email, concatenate 50 emails together (separated by commas or semicolons) into 1 email and put it in the BCC field.
A still better way would be if you could somehow make this process asynchronous.
-
Nov 18th, 2009, 05:30 PM
#6
Thread Starter
Lively Member
Re: HAND PLZ :Script timed out
First thank you
Please
can you rewrite the script using the suggestions you suggest
Last edited by nkkin; Nov 18th, 2009 at 05:41 PM.
-
Nov 20th, 2009, 03:28 AM
#7
Re: HAND PLZ :Script timed out
Have a look at the code below (changes are highlighted in red). It is not tested and my show errors, but it would al-teast give you the direction how to go about it.
Code:
<% If Session("project1_status") <> "login" Then Response.Redirect "admin.asp" %>
<!--#include file="header1.asp" -->
<div id="ContentHead"><b>Ajouter Actue:.</b></div>
<div id="Content"><center><br>
<!--#include file="connection.asp"-->
<!--#include file="dbnews.asp"-->
<%
add_dat=now()
section=request.form("section")
subject=request.form("subject")
subject= Replace(subject,"'","'")
subject= Replace(subject,"<","")
subject= Replace(subject,">","")
subject= Replace(subject,"é","é")
subject= Replace(subject,"è","è")
subject= Replace(subject,"â","â")
subject= Replace(subject,"û","û")
subject= Replace(subject,"î","î")
subject= Replace(subject,"ô","ô")
subject= Replace(subject,"à","à")
body=request.form("body")
body= Replace(body,"<img src='image url ici'width='550'></img><br>","")
body= Replace(body,"'","'")
body= Replace(body,"é","é")
body= Replace(body,"è","è")
body= Replace(body,"â","â")
body= Replace(body,"û","û")
body= Replace(body,"î","î")
body= Replace(body,"ô","ô")
body= Replace(body,"à","à")
photo=request.form("photo")
photo= Replace(photo,"'","'")
photo= Replace(photo,"é","é")
photo= Replace(photo,"è","è")
photo= Replace(photo,"â","â")
photo= Replace(photo,"û","û")
photo= Replace(photo,"î","î")
photo= Replace(photo,"ô","ô")
photo= Replace(photo,"à","à")
If subject="" or body="" or photo="" then
response.write "<font color=#ff8040>Please..vous devez remplir tous les champs</font><br>"
Else
addSQL= " insert into "§ion&" ([subject],[body],[add_dat],[photo]) values ('"&subject&"','"&body&"','"&add_dat&"','"&photo&"')"
ADO.execute(addSQL)
response.write "<center><b><font color=#ff8040>" & "THANK YOU... L'information est bien ajoutée</font>"
Set ADO = Server.CreateObject("ADODB.Connection")
ADO.Open xDb_Conn_Str
strsql = "SELECT * FROM [emails]"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, ADO
recActual = 0
Do While (NOT rs.EOF)
Dim MAX_RECIPIENTS_PER_EMAIL
MAX_RECIPIENTS_PER_EMAIL = 50 '<-- change this to whatever max your ISP allows.
Dim emailRecipientsCount, emailRecipients
emailRecipients = ""
For emailRecipientsCount = 1 to MAX_RECIPIENTS_PER_EMAIL
If rs.EOF Then Exit For
emailRecipients = emailRecipients & rs("Email") & ";"
rs.MoveNext
Next
recCount = recCount + 1
on error resume next
Set oMail =CreateObject("CDO.Message")
oMail.From = "www.nkkin-web.co.cc"
'oMail.To = rs("Email")
oMail.To = "[email protected]"
oMail.BCC = emailRecipients
oMail.Subject = "Nkkin-web:" & subject
oMail.BodyPart.charset = "unicode-1-1-utf-8"
oMail.BodyPart.ContentTransferEncoding = "quoted-printable"
oMail.HTMLBody = "<html><body bgcolor='#000000'><a href=http://users1.jabry.com/nkkin3 target=_blank><img src=http://users1.jabry.com/nkkin3/Files/Images/90x940Header.jpg></img></a><br><font color=#800000 size=4><b><center>" & subject & "</b></font></center><br /><font color=#000000 size=2><center><b>" & body & "</b><br /></font></center><br></body></html>"
oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxxxxxxxxxxxxxxxxxxx"
oMail.Configuration.Fields.Update
oMail.Send
set oMail=nothing
rs.MoveNext
Loop
rs.Close
ADO.Close
Set rs = Nothing
Set ADO = Nothing
End If
%>
<form method="POST" action="add_news.asp">
<table border="0"width="100%"color="#446677">
<tr><td width=20% bgcolor="#334466">
<p><b><center><font color="#800000"> TYPE:</font></center></td><td width=80%> <select size="1" name="section"class='tbox'>
<option value="news_news"> Actue générale </option>
<option value="amazigh_news"> Actue amazigh </option>
<option value="sport_news"> Actue sport </option>
</select></b></p></td></tr><tr><td width=20% bgcolor="#334466">
<p><b> <center><font color="#800000">subject:</font></center></td><td> <input type="text" name="subject"size="50"class='tbox'></b></p></td></tr><tr><td width=20% bgcolor="#334466">
<p><b><center><font color="#800000"> Photo url:</font> </center></td><td><input type="text" name="photo"size="50"class='tbox'></b></p></td></tr><tr><td width=20% bgcolor="#334466">
<p><b> <center><font color="#800000">body:</font></center></b></p></td><td><p><b> <textarea rows="6" name="body" cols="50"class='tbox'><img src='image url ici'width='550'></img><br></textarea></b></p></td></tr>
<tr><td> </span></td><td><p><input type="submit" value=" Add " name="add"class='button'><span lang="en-us"> <input type="reset" value=" Reset " name="reset"class='button'></p></span></td></tr></table></form><br>
</div>
<!--#include file="footer.asp" -->
-
Nov 20th, 2009, 03:33 AM
#8
Re: HAND PLZ :Script timed out
You can actually use the oMail.To field instead of the BCC field if privacy is not your concern. But all users may not like getting their email address exposed to others. Plus it is an invitation for spam mails if your email address is exposed in public emails from newsgroups, forums etc.
-
Nov 21st, 2009, 07:01 AM
#9
Thread Starter
Lively Member
Re: HAND PLZ :Script timed out
thank you very much i'll test it
-
Nov 21st, 2009, 07:07 AM
#10
Thread Starter
Lively Member
Re: HAND PLZ :Script timed out
please i want that the MAX_RECIPIENTS_PER_EMAIL get=recCount (number of emails in my data base)
Dim MAX_RECIPIENTS_PER_EMAIL
MAX_RECIPIENTS_PER_EMAIL = 50
-
Nov 21st, 2009, 12:08 PM
#11
Re: HAND PLZ :Script timed out
That is usually limited by the email service you are using. Your emails will still go like it was going before but in batches of 50 recipients per email instead of 1 recipient per mail.
Anyways if you want to send to all of them in one go, set this to a very high value.
e.g.
vb Code:
MAX_RECIPIENTS_PER_EMAIL = 9999999 'it might take you years before you cross this figure :) 'or MAX_RECIPIENTS_PER_EMAIL = rs.RecordCount
-
Nov 21st, 2009, 02:10 PM
#12
Thread Starter
Lively Member
Re: HAND PLZ :Script timed out
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|