0

Iam new to web hosting .I am trying to host a dynamic html page that shows an updated value from a json file which resides in the same directory where the html page is hosted. I hosted the page through IIS with port number 8081 as new website and when I browse the page , it is not showing the updated value from the josn file. If launch the page from the directory itself, it shows the updated values.

Expected: The web page should show the updated values from the json file whenvever it updates frequently

Actual: The web page shows the static value and not reading the values from the json when it get updated

Appreciate if anyone can help to resolve this issue?

hanju
  • 129
  • 1
  • 12
  • Don't suppose you've tried the ol' hard refresh in your browser? – EGC Sep 30 '19 at 04:48
  • Alternatively, you have to force update the page/read from JSON each time the JSON changes. So maybe check this out: https://stackoverflow.com/questions/37469178/how-to-refresh-a-page-whenever-my-json-data-file-changes – EGC Sep 30 '19 at 04:51

1 Answers1

0

You could set below iis setting to disable cache:

1)Open iis manager.

2)Select the site and click on the "HTTP response header feature".

3)Click on the set common header link from the action pane.

4)click the checkbox "expire web content" and select "immediately" radio button.

enter image description here

  • You could also set output caching in iis:
  • Click on the site name then go to output caching.
  • Click Add Cache Rule then type the extensions - .aspx, .aspx.vb, .aspx.cs, .js etc.
  • Then simply either tick the prevent all caching or untick user-mode caching and it should stop IIS from keeping a cache of the pages.

enter image description here

  • Next time you do a full refresh, it should get the files from the hard drive and not the cache/memory.

IIS Output Caching

another option is set some code in the page to prevent the browser from caching a JSON file.

you could also use iis application pool recycling but if you use session than it will lose the session data on application pool recycle.

How to refresh a page whenever my json data file changes

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26