URGENT : Asp page Refresh.

Posted on 2005-05-08
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

    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 this what u meant ?
    LVL 5

    Author Comment

    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

    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 )
    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
    LVL 3

    Expert Comment

    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.
    LVL 5

    Expert Comment


    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 %>
    LVL 2

    Expert Comment

    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
    LVL 7

    Accepted Solution

    <%@ 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 on my root and just include it wherever I need it like this:

    <!-- #include file="" -->

    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

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

    Expert Comment

    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

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now