[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


URGENT : Asp page Refresh.

Posted on 2005-05-08
Medium Priority
Last Modified: 2009-07-29
Hello experts,

I have a form in ASP with following option,

[Add], [Update], [GetList], [Save]

Process 1 :  On [Add] button click, User can add the new values in input form and press [Save] button to save the record.

After this on press of [GetList] button, This will list old values which r entered before the process 1, for getting the new values i have to refresh that frame.

Question : How to get the values without refresh the page.
I have set ALL IE properties.

Amit Jain
Question by:amit1978
LVL 33

Expert Comment

ID: 13957087
On pressing [GetList] i assume u r reading the data from the db and displaying them ?That would involve a refresh.
Or when you save the record u could store these values in hidden fields and when you press [GetList] u could
set them in ur form fields ( using javascript ) then there would be no need to refresh the page and when u click on add
u could just reset the values to blank...is this what u meant ?

Author Comment

ID: 13957330
I have saved the records in data base on save button click, and on Get list button it will fatch all the records from database.

But thing is it will display the old screen, to see the new update or recods i have to refresh that page.

If i am getting right this is the problem of cache, which i have to reset or reload on every time page accessed(For that i have chjage the IE setting).

LVL 33

Expert Comment

ID: 13957372
am a bit confused here ....
" I have saved the records in data base on save button click, and on Get list button it will fetch all the records from database.
But thing is it will display the old screen, to see the new update or recods i have to refresh that page. "

When u click on save what happens ? do you update the record and refresh the page( or redirect the page )..how
does the user know the page has been saved ?
After saving the page when u click on the getit the button will retrieve records unless it has not been updated.
Check whether u r updating the record before calling the getlist..maybe theres some loophole which u've missed in ur code
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Expert Comment

ID: 13957505
u should somehow set the cache properties for your page  as valid for only one time like that... i don't know how to do that.

Expert Comment

ID: 13957550

Set the Expires Property of Response Object to 0.
The Expires property specifies a length of time in minutes before a response page cached on the browser expires.
The 0 value code causes the page to be refreshed (reloaded) every time it is accessed, rather than being stored in a cache.
<% Response.Expires = 0 %>

Expert Comment

ID: 13958052
well, i am not what i am going to present is correct, but if not please ignore it

As i have read you may have used frame,
1/ form for adding
2/ listing your record

when you adding a new record you may go to one page
that page you write small javascript body onload which refresh your listing page
and after refresh it you may have redirect it to form add.

bj mac donel

Accepted Solution

TRACEYMARY earned 1000 total points
ID: 13958992
<%@ LANGUAGE=VBScript %>

ASP Check each page expires immediately. Prevents back tab from bringing up incorrect data.

<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = Now()

This is one of my favorite little scripts that I include on any page

Response.Expires = 15
Response.ExpiresAbsolute = Now() - 2
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "private"

On my site, I keep it in a file called nocache.inc on my root and just include it wherever I need it like this:

<!-- #include file="nocache.inc" -->

In most cases, with ASP applications, browser cache is our enemy.  

ASP pages are, by nature, dynamic. In contrast, HTML pages are static.  A great deal of work in the Web arena has gone into improving the response time for HTML pages.  Cache was designed to help solve this problem.

Page caching works beautifully for static HTML pages, but doesn't work well at all for ASP pages.  ASP pages often change because the back-end content has changed or the content changes in response to user input.  If the browser displays a cached page, the page may be out of date, or may not respond properly to user input.  The ASP server-side code does not run because the proxy intercepts the request before it reaches your server.  The Response object has several properties that can help solve this problem.  However, there are some problems with these that you should be aware of.

Response.Expires and Response.ExpiresAbsolute
Two good methods with easy properties to use and understand.  However, they don't work all the time.  The problem doesn't lie within the commands themselves--they do add the proper header values to the response; it's that not all browsers act the way you might expect.  Netscape browsers are particularly guilty of this improper behavior.  Futhermore, even if a browser is honoring the content expiration, a proxy server within a corporate network may intercept the request and return a cached page from the proxy server.  Proxy servers don't always honor the expiration date either.  To force the proxy to request a fresh copy of the page, you can use the Response.CacheControl property.

Set this to private to tell the proxy server NOT to cache the page.  Most proxy servers will not cache pages if the CacheControl value is set to private.

Again, unfortunately not all proxy servers honor the CacheControl header either.  With all of the uncertainty around who will and who will not honor response headers in web documents, ASP programmers have evolved a sure-fire method to force ASP page requests to refresh from the application server rather than from the cache or proxy server.  That method involves changing the URL in some unimportant way for each request.

Here is what I do at the top of every ASP page in my application.

<%@ Language=VBScript %>
<% Option Explicit %>
dim uUrl
uUrl = "uUrl=" & Date & Timer

Then anywhere in my document where I am navigating to another page, I use that variable in the URL.  Here are some examples of that.

Response.Redirect "somepage.asp?ID=1422&" & uUrl

<form action="somepage.asp?<%=uUrl%>">

<a href="somepage.asp?ID=1422&Search=find+me&<%=uUrl%>">

Because the date and time change constantly, the above method will append a unique string to the end of every URL reference in your application.  Thus, the browser will be unable to locate it in cache.


Expert Comment

ID: 15050051
i want to use some paraemeter in ASP on fly like query string ,how can i .
abhishek kumar

Expert Comment

ID: 15050071
hello sir/madam,

in ASP(VB Script) i want to use combo box and on selection of combo box item the data residing in another combo box should change tell me how?
Abhishek Kumar

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question