page not refreshing

After users add a new record they are taken back to a summary page.  I need this summary page to reflect the newly added data but it is not.  I have read that using a random number in the url will for force the page to refresh.  Also, I read that using the full URL will work (http://www.htmlgoodies.com/tutorials/getting_started/article.php/3479551/Reloading-The-Page.htm)

Neither method seem to be working (I need it to work with Internet Explorer).  

Any other suggestions?
            //var rndNum=Math.floor(Math.random()*100000);
            //window.location.href = 'PMQtrProgressReport.asp?rnum=' + rndNum + '&id=' + urlParams["leaderID"];                
            var newURL = window.location.protocol + "//" + window.location.host + "/QtrProgressReports/PMQtrProgressReport.asp?id=" + urlParams["leaderID"];        
            window.location.href = newURL;                

Open in new window

KCTechNetAsked:
Who is Participating?
 
GaryConnect With a Mentor Commented:
Instead of hard coding the headers try setting them thru ASP itself
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>

Open in new window


What version of IIS are you on?
0
 
GaryCommented:
Just add this to your HEAD
<meta http-equiv="Pragma" content="no-cache">
0
 
KCTechNetAuthor Commented:
That didn't seem to work either.  You mean to add that to my 'summary' page, the one I am trying to re-load, correct?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
GaryCommented:
Yes, problem is you may still be loading the old cached page so do an hard refresh (CTRL+F5)
0
 
KCTechNetAuthor Commented:
what about those that have also accessed the page? will their nightly log off take care of this?
0
 
KCTechNetAuthor Commented:
arg...ctrl-F5 didn't work either.  I did on both the summary and the data entry pages.  Of course it refreshes for that moment, but the next data entry does not refresh.
0
 
KCTechNetAuthor Commented:
the summary page is classic ASP if that matters for anything...
0
 
COBOLdinosaurCommented:
Are you sure that the update has actually been saved at the point you change the location.

We have only a tiny out of context fragment of code so the operational flow is not clear.

Cd&
0
 
KCTechNetAuthor Commented:
there is a submit button which calls an ASP page to write the record.  the ASP page returns the record id.  if the record id exists, then I know the save was successful.  If not, an error displays that they need to try and re-submit. saveForm will return with true if successful..

    function newWindow(doSave) {  //btnCancel sends a false, btnSave send a true      
        if (saveForm(doSave)) {
            var rndNum=Math.floor(Math.random()*100000);
            window.location.href = 'PMQtrProgressReport.asp?rnum=' + rndNum + '&id=' + urlParams["leaderID"];                
            //var newURL = window.location.protocol + "//" + window.location.host + "/QtrProgressReports/PMQtrProgressReport.asp?id=" + urlParams["leaderID"];        
            //window.location.href = newURL;                
        }
    }  

Open in new window

0
 
Sar1973Commented:
Try to lauch an alert("window.location.protocol") to check if the double slash is included or not.
0
 
KCTechNetAuthor Commented:
it is not included.  Not sure if this matters, but this is an Intranet page, not extranet
0
 
GaryCommented:
Try these tags in your head.

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />

Open in new window

0
 
KCTechNetAuthor Commented:
That didn't seem to work either.  I also hit Ctrl-F5 when the page first loaded to make sure it contained the changes.
0
 
GaryCommented:
Try this after your closing BODY tag
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>

Open in new window

Makes no sense I know but this is IE
0
 
KCTechNetAuthor Commented:
nope.  didn't work.    I don't see how the random number in the URL wouldn't work.  this makes no sense.

I am wondering if there is a way to code a page reload just the first time?  I don't see how because it seems it would get stuck in a loop...  or, even though the content doesn't need refreshing while open, add a refresh timer for every 15 seconds or something?
0
 
GaryCommented:
After trying all the recommended ways, the only assumption is that your server is caching the page.

(assuming you are editing the correct page)
0
 
KCTechNetAuthor Commented:
i am editing the 'summary' page, which is the one that I want to be refreshed.  Or should I be adding it to the one that adds the data and calls the summary page?

Any links that discuss the server settings?

Or any thought on JavaScript refresh on first load only?
0
 
KCTechNetAuthor Commented:
That didn't work either.  I am not sure what version we are using. I would need to ask the engineers.

I was actually thinking of making some changes to the page, moving away from ASP to jQuery/Ajax.  I wonder if that would 'fix' the issue???
0
 
GaryCommented:
It's a possibility.
But ask them to check the caching on the server first.
0
 
KCTechNetAuthor Commented:
they haven't had a chance to look at the cache settings yet, but I changed the page from ASP to javascript.  Oh boy, that made things worse.  Now, refresh and Ctrl-F5 no longer work.  I have to close the browser and re-launch to see the newly added record.
0
 
KCTechNetAuthor Commented:
an odd thing is I added an alert and it appears to be looping through the recordset fetching the newest records.  Could the ASP page I am getting the data from be the issue...in this case "DynamicReturn.asp"
    function getContent() {
        $.getJSON( 'DynamicReturn.asp',{proc:"Get" + surveyType + "SurveySummary_new",params: staffID}, function (data) { 
                var html = '';
                var nextStartDate;
                var lastProgram = 0;
                
                if (data) {
                    alert(data[0].SLTName);

Open in new window

0
 
KCTechNetAuthor Commented:
here is the code for DynamicReturn.asp
<!--#include file="adovbshd.inc"-->
<!--#include file="constring.inc"-->

<!--#include file="lib/JSON_2.0.4.asp"-->
<!--#include file="lib/JSON_UTIL_0.1.1.asp"-->
<%

Dim DataConn
Dim procName, paramList
dim sql
    
' Create and establish data connection
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.ConnectionTimeout = 15
DataConn.CommandTimeout = 30

'SQL connection code
DataConn.Open strsrvCon
procName =  Request.QueryString("proc")
paramList =  Request.QueryString("params")

sql = "exec " & procName & " " & paramList

'http://code.google.com/p/aspjson/
QueryToJSON(DataConn,sql).Flush

%>

Open in new window

0
 
KCTechNetAuthor Commented:
arg..that was it the whole time.  I needed to add your code to the DynamicReturn.asp page.

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

Open in new window

0
 
GaryCommented:
lol - where were you adding it?

Ahh I see where your problem was
0
 
KCTechNetAuthor Commented:
luckily the DynamicReturn is just that, dynamic.  It handles all my data retrieves for all pages.  So I just need to update the one page.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.