0

I am currently developing a web-part that generates a mega-menu for SharePoint 2010. The issue I am having is that when the user generates the menu, I have the web-part generate an HTML file and store it in SharePoint's style directory. The problem I am facing is how do I force SharePoint to refresh it's page cache to read the updated HTML file? I have no idea how to do this and my Google searches haven't turned up anything useful.

I know that I can save the file directly to disk and have SharePoint's cache monitor any modifications to the file and automatically update itself. However the problem with this solution is that we have multiple WFEs so the WFE that actually has the file written to it is the only server showing the updated menu.

Since this solution didn't work for us, I thought writing the HTML file to the style directory would allow all WFE's to see it. But I am stuck at how to force the cache to refresh itself after the is file updated. I know this is possible because if I modify the style sheet in the same directory, that automatically updates the look of the page on refresh.

Any suggestions on how to accomplish this would be greatly appreciated.

  • Have you tried to recycle app pool or iis reset, if that works? – Waqas Sarwar MVP Dec 6 '17 at 16:57
  • @WaqasSarwarMVP I don't want to temporarily disable the site by doing an IIS reset. Also, updating the mega menu is being done by Communications, so they don't have the access or ability to do something like that. – user5013 Dec 6 '17 at 17:43
  • Do you refer the html file using the url? Hope the issue is with the browser cache and not with BLOB cache. – Prasanna Dec 6 '17 at 18:03
0

My suggestion is to use a dynamic URL to refer the html file in the web part code if the issue is with the browser cache and you use the url to browse the html file.

Ex:

http://siteurl/style library/menu.html can be accessed through
http://siteurl/style library/menu.html?version=[something dynamic]

[Something dynamic] can be a random number generate through the code. Then browser should consider this as a new file and load the file every time and browser caching issue should be resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.