Force client refresh after site update. How to?

Discussion in 'ASP .Net' started by bob, Jun 2, 2010.

  1. bob

    bob Guest

    Hi,

    Can someone please suggest a reliable way of forcing refresh of a site that
    has been updated? I'm running into problems with java script and some
    images (e.g. menu backgrounds, buttons, etc.) which do not always get sent
    to clients after being changed.
    The only solution seems for clients to click "Refresh" button in their
    browser.

    Thanks.
     
    bob, Jun 2, 2010
    #1
    1. Advertising

  2. bob

    Binu T V Guest

    Hi,

    Make the behaviour of update button to submit
    <form method="post" action="/Home/UpdatePage.aspx?Action=Update" >
    <input type="submit" runat="server" id="btnUpdate" />
    </form>

    or

    <asp:Button ID="btnUpdate" Text="Update" runat="server" UseSubmitBehavior="true" OnClick="btnUpdate_Click" />

    write the btnUpdate_Click method body in code behind page
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
    }

    Regards,
    Binu



    bob wrote:

    Force client refresh after site update. How to?
    01-Jun-10

    Hi

    Can someone please suggest a reliable way of forcing refresh of a site tha
    has been updated? I am running into problems with java script and som
    images (e.g. menu backgrounds, buttons, etc.) which do not always get sen
    to clients after being changed
    The only solution seems for clients to click "Refresh" button in thei
    browser

    Thanks.

    Previous Posts In This Thread:


    Submitted via EggHeadCafe - Software Developer Portal of Choice
    WPF Report Engine, Part 4
    http://www.eggheadcafe.com/tutorial...45-8b37cb7f3186/wpf-report-engine-part-4.aspx
     
    Binu T V, Jun 2, 2010
    #2
    1. Advertising

  3. bob

    bob Guest

    Re: RE:Force client refresh after site update. How to?

    Thanks for the reply. Unfortunately I think that you misunderstood my
    original post (it could be that I wasn't very clear).

    Anyway, what I'm trying to do is to make sure that if I make any changes to
    javascripts in my app on the server those changes will be guaranteed to be
    'seen' by all clients that connect to the site afterwards. This generally
    happens with aspx pages and most of the images. Unfortunately javascript
    resources are not always downloaded to clients after being changed.

    For example, one of my clients had been using the app for months with no
    problems. A week ago I made some changes to some of java scripts and
    updated the site. The first time the client connected to the site after the
    update the app was really messed up in his browser. He had to click
    "Refresh" button in his browser in order to get the app working properly.

    I'm wondering if there is something I could do on the server side to force
    client browser to re-load updated java scripts without clients manually
    refreshing the associated pages.

    Any thoughts?
    thanks.


    <Binu T V> wrote in message news:...
    > Hi,
    >
    > Make the behaviour of update button to submit
    > <form method="post" action="/Home/UpdatePage.aspx?Action=Update" >
    > <input type="submit" runat="server" id="btnUpdate" />
    > </form>
    >
    > or
    >
    > <asp:Button ID="btnUpdate" Text="Update" runat="server"
    > UseSubmitBehavior="true" OnClick="btnUpdate_Click" />
    >
    > write the btnUpdate_Click method body in code behind page
    > protected void btnUpdate_Click(object sender, EventArgs e)
    > {
    > }
    >
    > Regards,
    > Binu
    >
    >
    >
    > bob wrote:
    >
    > Force client refresh after site update. How to?
    > 01-Jun-10
    >
    > Hi,
    >
    > Can someone please suggest a reliable way of forcing refresh of a site
    > that
    > has been updated? I am running into problems with java script and some
    > images (e.g. menu backgrounds, buttons, etc.) which do not always get sent
    > to clients after being changed.
    > The only solution seems for clients to click "Refresh" button in their
    > browser.
    >
    > Thanks.
    >
    > Previous Posts In This Thread:
    >
    >
    > Submitted via EggHeadCafe - Software Developer Portal of Choice
    > WPF Report Engine, Part 4
    > http://www.eggheadcafe.com/tutorial...45-8b37cb7f3186/wpf-report-engine-part-4.aspx
     
    bob, Jun 2, 2010
    #3
  4. bob

    Jason Keats Guest

    Jason Keats, Jun 2, 2010
    #4
  5. bob

    3P Guest

    Dnia 02-06-2010 o 04:21:23 bob <> napisa³(a):

    > Hi,
    >
    > Can someone please suggest a reliable way of forcing refresh of a site
    > that
    > has been updated? I'm running into problems with java script and some
    > images (e.g. menu backgrounds, buttons, etc.) which do not always get
    > sent
    > to clients after being changed.
    > The only solution seems for clients to click "Refresh" button in their
    > browser.
    >
    > Thanks.
    >


    First. For performance reasons static files (js, css, image files) should
    have age expires
    set to far future (one year is standard). ETag header is unnecessary then
    and can/should be removed.

    Then when You change these files You rename them for example from
    myscripts.js
    to
    myscripts_v2.js

    Or You add query parameters on pages where those files are used.
    So instead of <img href="picture.gif">
    You do <img href="picture.gig?v=2">

    You can try to make it full auto and add for example assembly version to
    all the references to those files.
     
    3P, Jun 2, 2010
    #5
  6. bob

    sharp3d

    Joined:
    Jun 17, 2011
    Messages:
    1
    Thank you! Query parameters saved my butt today.


     
    sharp3d, Jun 17, 2011
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fredo Vincentis

    force REFRESH after hitting back button

    Fredo Vincentis, Nov 7, 2003, in forum: HTML
    Replies:
    1
    Views:
    4,231
    Toby A Inkster
    Nov 7, 2003
  2. =?Utf-8?B?Y2xpZW50IHNpdGUgZGxsIGluIHZic2NyaXB0?=

    Acceessing client site dll in vbscript at client site

    =?Utf-8?B?Y2xpZW50IHNpdGUgZGxsIGluIHZic2NyaXB0?=, Jun 13, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    5,864
    =?Utf-8?B?Y2xpZW50IHNpdGUgZGxsIGluIHZic2NyaXB0?=
    Jun 14, 2006
  3. Jon   Paal
    Replies:
    0
    Views:
    643
    Jon Paal
    Feb 9, 2007
  4. Michael Schöller
    Replies:
    1
    Views:
    2,215
    Michael Schöller
    Nov 23, 2009
  5. joebloe
    Replies:
    4
    Views:
    199
    joebloe
    May 19, 2008
Loading...

Share This Page