• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

how to code an aspx page perform a page refresh when it is opened.

How can you make sure that the browser will refresh (equivalent to F5) all css when a page is loaded.

I need to make sure that the cached version of the page does not get used.
0
JOHNFROG
Asked:
JOHNFROG
1 Solution
 
LZ1Commented:
You could try something like this in the head of your pages:
<meta http-equiv="Cache-control" content="no-cache">

Open in new window

0
 
Rose BabuSenior Team ManagerCommented:
Hi,

try the below points

1. set Auto Refresh in page head. it will refresh the changes on css and page (300 = 5min)

<meta http-equiv="refresh" content="300">

2.  do below code in page_init or page_load

HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(False)
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
HttpContext.Current.Response.Cache.SetNoStore()
Response.Cache.SetExpires(DateTime.Now)
Response.Cache.SetValidUntilExpires(True)

3. Set some meta tags as follows

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

hope it may help you.
0
 
Saqib KhanSenior DeveloperCommented:
or simple rename the CSS file to something else...apply name change within HTML page and you should be good.
0
 
JOHNFROGAuthor Commented:
I have now attempted to implement each of the above except for adilkhans suggestion and still I must physically hit the F5 key to update a css change that was made in the same session.

I dont follow adilkhan? how is this to be done?

Currently I have a webform that will allow the user to change the contents of the background.jpg file that is referenced in the css. Once the change is selected the background image for the main web page remains the same as it was before the change was made. F5 needed to display the updated image.
0
 
JOHNFROGAuthor Commented:
Using chrome. strangely am seeing this solved for only a percentage of the time. Beginning to think this might be more browser behaviour than anything i can code
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now