Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP Include Problems

Reply
Thread Tools

ASP Include Problems

 
 
Max Hazelhurst
Guest
Posts: n/a
 
      02-10-2004
Hi there,

Got an include file causing a timeout on the server when it's called on...

The code has a loop in it that I suspect may be the cause...

I can forward the entire inc file should it be necessary...

Many thanks as ever..
Max
Maxh att zelhurst dott com



if (user_id = "") Then
loggedin=false
do
user_id=generateID(5)
user_sql="SELECT tbl_user.user_id FROM
tbl_user WHERE ((tbl_user.user_id)=" & user_id & ");"
loop while db_validate(user_id, user_sql)

user_sql= "INSERT INTO tbl_user (user_id,
username, lastipaddress, lastcompname, expires )VALUES "
user_sql= user_sql & "('" & user_id & "','" &
"','" & Request.ServerVariables("REMOTE_ADDR") & "','" &
Request.ServerVariables("REMOTE_USER") & "','" & user_expires &
"');"
conn.Execute(user_sql)
end if

 
Reply With Quote
 
 
 
 
Chris Barber
Guest
Posts: n/a
 
      02-10-2004
<woeful-plea instyleof="Shakespearian Tragedy">
Doesn't anybody care about code readability, comments, case, error
handling, and variable declaration anymore?
</woeful-plea>

What is the function db_validate() that provides the loop exit point?

In order to debug you need to fix your code first by making judicious use
of:

Option Explicit
Dimension your variables
Place comments in the code to say what's going on.
Never have loops that don't have a 'get out' clause (eg. after 5 seconds
or 1000 loops etc.).
Include error traps to detect errors after SQL executions (implies use
of On Error Resume Next).

I'm not having a go at *you* but your post is symptomatic of a lot of very
short requests for help that are patently impossible to comment on without
the request for 'a short code section that is self-contained and
demonstrates the issue'.

To be honest, you seem to have found the issue already - examine your loop
response in debug mode and I'm sure you'll find the source of the problem.
At the very least put a get out clause in that allows you to report and
process the error (if it's an error that's occurring).

Regards,

Chris Barber.


"Max Hazelhurst" <(E-Mail Removed)> wrote in message
news:BC4E97ED.AAA%(E-Mail Removed)...
Hi there,

Got an include file causing a timeout on the server when it's called on...

The code has a loop in it that I suspect may be the cause...

I can forward the entire inc file should it be necessary...

Many thanks as ever..
Max
Maxh att zelhurst dott com



if (user_id = "") Then
loggedin=false
do
user_id=generateID(5)
user_sql="SELECT tbl_user.user_id FROM
tbl_user WHERE ((tbl_user.user_id)=" & user_id & ");"
loop while db_validate(user_id, user_sql)

user_sql= "INSERT INTO tbl_user (user_id,
username, lastipaddress, lastcompname, expires )VALUES "
user_sql= user_sql & "('" & user_id & "','" &
"','" & Request.ServerVariables("REMOTE_ADDR") & "','" &
Request.ServerVariables("REMOTE_USER") & "','" & user_expires &
"');"
conn.Execute(user_sql)
end if


 
Reply With Quote
 
 
 
 
Chris Barber
Guest
Posts: n/a
 
      02-10-2004
Just so I don't come across as a complete moron, I've already apologised to David for my harsh post having started and email discussion. Turns out that it's not his code (as I should have suspected) but as usual belongs to 'another' developer

<quote>
This is a bit of a strange one as I've inherited the maintenance of this site from another developer who is not around to advise...
</quote>
Of course ... we're all just fixing someone else's code. Seems like the industry has found a way to self-perpetuate. I write bad code and come back 2 years later to a new boss and fix it thus getting paid twice (unless I'm daft enough to leave my name in the comments of course). Wasn't me honestly, it was my evil twin brother ...

LoL.

After feeling guilty for a few mins 'we' may have found a suspect loop that appears to run indefinitely in certain circumstances thus hanging ASP.

Chris.

"Chris Barber" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
<woeful-plea instyleof="Shakespearian Tragedy">
Doesn't anybody care about code readability, comments, case, error
handling, and variable declaration anymore?
</woeful-plea>

What is the function db_validate() that provides the loop exit point?

In order to debug you need to fix your code first by making judicious use
of:

Option Explicit
Dimension your variables
Place comments in the code to say what's going on.
Never have loops that don't have a 'get out' clause (eg. after 5 seconds
or 1000 loops etc.).
Include error traps to detect errors after SQL executions (implies use
of On Error Resume Next).

I'm not having a go at *you* but your post is symptomatic of a lot of very
short requests for help that are patently impossible to comment on without
the request for 'a short code section that is self-contained and
demonstrates the issue'.

To be honest, you seem to have found the issue already - examine your loop
response in debug mode and I'm sure you'll find the source of the problem.
At the very least put a get out clause in that allows you to report and
process the error (if it's an error that's occurring).

Regards,

Chris Barber.


"Max Hazelhurst" <(E-Mail Removed)> wrote in message
news:BC4E97ED.AAA%(E-Mail Removed)...
Hi there,

Got an include file causing a timeout on the server when it's called on...

The code has a loop in it that I suspect may be the cause...

I can forward the entire inc file should it be necessary...

Many thanks as ever..
Max
Maxh att zelhurst dott com



if (user_id = "") Then
loggedin=false
do
user_id=generateID(5)
user_sql="SELECT tbl_user.user_id FROM
tbl_user WHERE ((tbl_user.user_id)=" & user_id & ");"
loop while db_validate(user_id, user_sql)

user_sql= "INSERT INTO tbl_user (user_id,
username, lastipaddress, lastcompname, expires )VALUES "
user_sql= user_sql & "('" & user_id & "','" &
"','" & Request.ServerVariables("REMOTE_ADDR") & "','" &
Request.ServerVariables("REMOTE_USER") & "','" & user_expires &
"');"
conn.Execute(user_sql)
end if


 
Reply With Quote
 
Bullschmidt
Guest
Posts: n/a
 
      02-12-2004
Don't know if this would help at all:

' Script timeout in seconds for this page.
' (60 x 60 = 1 hour.)
Server.ScriptTimeout = 60 * 60

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
ASP Include file error <!-- #include file="" --> naveeddil ASP .Net 0 01-04-2008 12:58 PM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 10 01-11-2007 07:38 AM
ASP Error 0126 include file not found, when using ".." in include file path Eric ASP General 0 01-09-2007 06:54 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments