Results 1 to 12 of 12

Thread: HAND PLZ :Script timed out

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    124

    Question 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.

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    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.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    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.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    124

    Question 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,"'","&#39;")
    subject= Replace(subject,"<","")
    subject= Replace(subject,">","")
    subject= Replace(subject,"é","&eacute;")
    subject= Replace(subject,"è","&egrave;")
    subject= Replace(subject,"â","&acirc;")
    subject= Replace(subject,"û","&ucirc;")
    subject= Replace(subject,"î","&icirc;")
    subject= Replace(subject,"ô","&ocirc;")
    subject= Replace(subject,"à","&agrave;")
    body=request.form("body")
    body= Replace(body,"<img src='image url ici'width='550'></img><br>","")
    body= Replace(body,"'","&#39;")
    body= Replace(body,"é","&eacute;")
    body= Replace(body,"è","&egrave;")
    body= Replace(body,"â","&acirc;")
    body= Replace(body,"û","&ucirc;")
    body= Replace(body,"î","&icirc;")
    body= Replace(body,"ô","&ocirc;")
    body= Replace(body,"à","&agrave;")
    photo=request.form("photo")
    photo= Replace(photo,"'","&#39;")
    photo= Replace(photo,"é","&eacute;")
    photo= Replace(photo,"è","&egrave;")
    photo= Replace(photo,"â","&acirc;")
    photo= Replace(photo,"û","&ucirc;")
    photo= Replace(photo,"î","&icirc;")
    photo= Replace(photo,"ô","&ocirc;")
    photo= Replace(photo,"à","&agrave;")
    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 "&section&" ([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&eacute;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"> &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Actue g&eacute;n&eacute;rale &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</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>&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;</span></td><td><p><input type="submit" value=" Add " name="add"class='button'><span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value=" Reset " name="reset"class='button'></p></span></td></tr></table></form><br>



    </div>

    <!--#include file="footer.asp" -->

  5. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    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.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    124

    Re: HAND PLZ :Script timed out

    First thank you
    Please
    can you rewrite the script using the suggestions you suggest



    Code:
    thank Y O U
    Last edited by nkkin; Nov 18th, 2009 at 05:41 PM.

  7. #7
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    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:
    <&#37; 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,"&#233;","&eacute;")
    subject= Replace(subject,"&#232;","&egrave;")
    subject= Replace(subject,"&#226;","&acirc;")
    subject= Replace(subject,"&#251;","&ucirc;")
    subject= Replace(subject,"&#238;","&icirc;")
    subject= Replace(subject,"&#244;","&ocirc;")
    subject= Replace(subject,"&#224;","&agrave;")
    body=request.form("body")
    body= Replace(body,"<img src='image url ici'width='550'></img><br>","")
    body= Replace(body,"'","'")
    body= Replace(body,"&#233;","&eacute;")
    body= Replace(body,"&#232;","&egrave;")
    body= Replace(body,"&#226;","&acirc;")
    body= Replace(body,"&#251;","&ucirc;")
    body= Replace(body,"&#238;","&icirc;")
    body= Replace(body,"&#244;","&ocirc;")
    body= Replace(body,"&#224;","&agrave;")
    photo=request.form("photo")
    photo= Replace(photo,"'","'")
    photo= Replace(photo,"&#233;","&eacute;")
    photo= Replace(photo,"&#232;","&egrave;")
    photo= Replace(photo,"&#226;","&acirc;")
    photo= Replace(photo,"&#251;","&ucirc;")
    photo= Replace(photo,"&#238;","&icirc;")
    photo= Replace(photo,"&#244;","&ocirc;")
    photo= Replace(photo,"&#224;","&agrave;")
    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 "&section&" ([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&eacute;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"> &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Actue g&eacute;n&eacute;rale &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;</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>&nbsp;<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>&nbsp;&nbsp;&nbsp;&nbsp;</span></td><td><p><input type="submit" value=" Add " name="add"class='button'><span lang="en-us">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value=" Reset " name="reset"class='button'></p></span></td></tr></table></form><br>
    
    
    
    </div>
    
    <!--#include file="footer.asp" -->
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  8. #8
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    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.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    124

    Re: HAND PLZ :Script timed out

    thank you very much i'll test it

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    124

    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

  11. #11
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    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:
    1. MAX_RECIPIENTS_PER_EMAIL = 9999999     'it might take you years before you cross this figure :)
    2. 'or
    3. MAX_RECIPIENTS_PER_EMAIL = rs.RecordCount
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    124

    Re: HAND PLZ :Script timed out

    thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width