Force client refresh after site update. How to?

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

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.
 
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
 
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.
 
Dnia 02-06-2010 o 04:21:23 bob said:
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.
 
Back
Top