As the title hints, I am using WestWind.globalisation as a database resource provider to support multiple languages.
The problem is, that the resource provider it self seems reluctant to reflect the changes I make in the application.
An example:
I have an element:
<asp:Image runat="server" ID="img_placeholder" ImageUrl="~/images/BigPicture.jpg" />
I have inserted the following data into my localization table:
pk ResourceId Value LocaleId ResourceSet
--------------------------------------------------------------------------------
391 ImgBigPicture.ImageUrl ~/images/BigPicture-en-US.jpg en-US Site.master
392 ImgBigPicture.ImageUrl ~/images/BigPicture.jpg Site.master
393 ImgBigPicture.ImageUrl ~/images/BigPicture-fr-FR.jpg fr-FR Site.master
After this I changed the markup to this:
<asp:Image runat="server" ID="img_placeholder" ImageUrl="~/images/BigPicture.jpg" meta:resourceKey="ImgBigPicture"/>
When I refresh the application or rebuild it, the changes are not displayed in the browser. The picture url stays the same. the same can be observed at any given element, be it an asp:Label
or an asp:Button
.
Sometimes restarting the IIS suffices; sometimes it is enough to restart Visual Studio and Chrome to get the changes working. Mostly I need to reboot the server so everything is displayed in its current and actual state. When it does I can switch my UIculture and the property changes accordingly.
I don't know what is going on and stepping through the code does not reveal anything to me.
I am open to any suggestions and solutions on how to cope with this.
The way resource sets work in .NET, they are loaded only once and then cached in memory. This means when a ResourceSet is requested by ASP.NET for the first time resources are loaded and then never again until the AppDomain is restarted. So any changes you make to the db Resources is not immediately reflected.
On the admin form there's an option that allows you to unload the DbResources. The dbResourceProvider supports unloading of resources using this mechanism to force a reload on the next access. So unless you do this the resources will not reload.
An IIS restart, Application Pool Recycle or even a web.config change (anything that causes the AppDomain to be shut down and restarted) will also clear resources and start over.
If you still see the same resources you are probably dealing with browser caching. Chrome especially is very aggressive with its browser cache and images often only reload if you load them explicitly into a window and do a hard refresh (Shift-f5). If you're testing in Chrome and you want to see new images use the developer tools Clear Browser Cache option to clear out your cache completely (or right click the Refresh button and choose Clear Cache and Reload).