0

This should be simple:

1) web page contains a number of literals with default values

2) Literal text is updated as the user interacts with the application

3) user clicks on an href and navigates away from the site

4) user returns via back button.

Problem: the literals default values load from cache? I would like to value (text) to contain the data of the current values NOT the default text.

Is there a way to update the cache for a asp.net Literal? Thanks for any help

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
user1195021
  • 49
  • 1
  • 6

2 Answers2

0

No its not from the cache

its the default life cycle which again occur

you should use session / cookies(not recommended) in order to save/read later the modified text.

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
0

I think the problem is that clicking the back button, in most browsers, results in the browser to use the previously cached html for that url. So, the browser does not repeat the request to the server, as you may be expecting.

Maybe add cache instructions to the response headers for that aspx page to "ask" the browser to never cache it. That should result in the browser always requesting the page, even after back-button click. If this is the case, you can use this as an example on how to do that: Disabling browser caching for all browsers from ASP.NET

Community
  • 1
  • 1
  • Thank you, Disabling the browser caching causes a page event on the back-button click. What would be nice if I could allow the browser to use cache. I was looking for a way to update the browser cache ever time the literal text was modified. Is there a way to refresh the browser cache? – user1195021 Feb 07 '12 at 17:00
  • Not that I know of - probably not, as I immediately see a security issue with that (some externally referenced JS code could update cache that relates to your page, which could trick the user in whatever you can imagine). –  Feb 07 '12 at 18:17
  • I thought as much, Thank you for your time – user1195021 Feb 07 '12 at 19:04