Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a Do While Loop

Status
Not open for further replies.

lcutliffe

IS-IT--Management
Dec 1, 2006
30
US
I have a ASP page that is set to auto refresh every 3 minutes. Every now and then I get a 500 error which stops the page. I read about using a DO WHILE LOOP in the page where it will keep trying to get the page until successful.
Problem is, Im not really sure about the syntax. Any help would be appreciated.
 
The refresh is probably done by browser-side script so it isn't really ASP since ASP logic exectues on the web server, not in the browser.

Anyway, the syntax is:[tt]
x = 1
Do While x <= 10
Response.Write x & "<br>" & vbCrLf 'output the value of x
x = x + 1
Loop
[/tt]


This syntax is often used with an ADO recordset object to output all rows:[tt]
Do While Not rs.EoF
Response.Write rs("foo") & "<br>" & vbCrLf
rs.MoveNext
Loop
[/tt]
 
The ASP pages are set to refresh on the server but on occasion something happens and the page dies out and shows me a 500 error. From what i read, and some forums i asked, it was suggested that I use a do while loop so if that happens the page itself will keep working to come back up. Unless you have a better idea.
 
it was suggested that I use a do while loop so if that happens the page itself will keep working to come back up.
Errm Nope.

If a 500 error has occured you aren't even looking at the same page.
Processing has stopped and a different page (the 500 error page) has been served up.

have a look at this faq333-5427 so you can find out exactly what and where the error is and fix it.


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Much appreciated Chris, that definately pointed me in the right direction.
 
What do you mean the pages "are set to refresh on the server" ?

That doesn't make any sense.

A browser can refresh by requesting a new copy of the page from the server but in this case the server simply runs the same logic again from the top, it is not a continuation of the previous exectution.

By the time the page finishes loading in your browser, the server is done working on the ASP and has gone on to handling a different page for someone else.
 
%>
<meta http-equiv="Refresh" content="180;URL=Plant 6 Rod Schedule v1.3-dynamic.asp?
<%

Thats the method it is refreshing by. Sorry for the vague explanation.
 
OK, yes this is an instruction to the browser.

Notice how the ASP processing is turned off immediatly before this line and then it is turned back on afterwards.
 
Problem is fixed thanks for the input sheco appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top