Forum Moderators: open

Message Too Old, No Replies

Stopping the timer

         

chris_f

6:31 pm on Jan 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Guys,

I have a timer on every page of my site. This tells me how long the server spent building the page so that I can improve my code. However, the count doesn't reset with every page. Can anyone see my problem.

At the begining of my page is:

<%
Dim startTime
startTime = Timer()
%>

And at the bottom of the page is:

This page was generated in <%=Round((Timer - StartTime)*1000) %> milliseconds

Chris.

chris_f

6:48 pm on Jan 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



URGENT BOOST

RossWal

7:04 pm on Jan 8, 2003 (gmt 0)

10+ Year Member



At the risk of asking the obvious, could the page be caching and not actually rebuilding each time?

korkus2000

7:05 pm on Jan 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is this .Net or classic ASP?

wardbekker

7:46 pm on Jan 8, 2003 (gmt 0)

10+ Year Member



chris_f,

This sound like a cache-related issue. This can be easly checked by outputting the datetime and comparing it with the last one.

<% =Now() %>

chris_f

12:43 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry for the late get back. I was busy last night and had to disappear just after the boost. It is classic ASP alas (I wish some of my clients hosts would 'Get with the times man').

I am thinking that instead of using a timer I'll simply have 2 Now() calls and do the calculation. However, I don't know if Now() calculates to the millisecond.

I don't think it is a caching issue but I can't be certain. I have copied and pasted some code from another one of my sites. That code also produces the same problem.

I'll try again tonight. I should have more time and might not be as tired. Damn steriods, 3 hours sleep in two nights ... not good.

Chris

korkus2000

12:49 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you added this code to the top of all your asp pages?

<%
Response.Expires = -1
Response.Expiresabsolute = Now() - 2
Response.addheader "pragma","no-cache"
Response.addheader "cache-control","private"
Response.CacheControl = "no-cache"
%>

It will make sure there is no caching issue.

chris_f

1:18 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have used them lines before, however, I haven't in the current site and I didn't use them in the site that the code works on. I'll give it a go tonight though.

Chris

chris_f

6:12 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've added the no caching code and uploaded to the internet. It is still NOT displaying the timer correctly. It is not resetting it.

Chris

chris_f

6:18 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Taking one now() from another does not work.

Chris

wardbekker

6:19 pm on Jan 9, 2003 (gmt 0)

10+ Year Member



chris_f,

Very strange, i use it all the time like that. If you add a timestamp to that page (for example <% =Now() %>), does the datetime change? This is the only way to be certain the page isn't cached.

[edited by: wardbekker at 6:21 pm (utc) on Jan. 9, 2003]

chris_f

6:21 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Date changes ok. I'll sticky you a url. Could it be my IE.

wardbekker

6:25 pm on Jan 9, 2003 (gmt 0)

10+ Year Member



Chris,

Works perfectly here. Did you check "always check for new page on every visit" or something in IE?

chris_f

6:27 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



checked. I'm seeing across different browsers.

what are you seeing if you continue to refesh the page. my counter just increases.

chris

chris_f

6:44 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



BINGO. I think it's because I changed from SSI includes throught HTML to server.execute in ASP. I can't be certain though.

Thanks for all your help ESPECIALLY wardbekker.

Chris