I am trying to roll my own DBResourceProviderFactory based on this MSDN article.

I downloaded the code and opened the solution. For a start I do not want a seperate solution. The resource provider should be in my web application. So I copied all the code files (DBResourceProviderFactory.cs DBResourceProvider.cs StringResourcesDALC.cs ...) to my project and corrected the namespace, fixed the local resources and edited the connectionstring in the DALC accordingly.

In the web.config I addes this gloablization configuration:

<system.web>
    <!--If MyApllicationNamespace is ommited, exception is thrown at runtime.-->
    <globalization culture="auto" uiCulture="auto" resourceProviderFactoryType="MyApplicationNamespace.DBResourceProviderFactory" />
</system.web>

In the default.aspx I added this label:

<asp:Label ID="lblHello" runat="server" Text="not translated" meta:resourceKey="lblHello"></asp:Label>

The database table contains 3 rows of data for this resource.

Upon building the application and running it in the browser, the label keeps its initial text "not translated" and all breakpoints, which I set in the DBResourceProdivder classes are never hit, hence the code is never called.

My question is: Why is it never called?

Additional Information: There are 2 labels present, which have the corresponding resourceKeys in the database

<asp:Label ID="lblHello" runat="server"  Text="HelloDefault" meta:resourcekey="lblHello" />
<asp:Label ID="lblGoodbye" runat="server"  Text="GoodByeDefault" meta:resourcekey="lblGoodbye" />

ResourceType | CultureCode | ResourceKey     | ResourceValue 
---------------------------------------------------------------
Default.aspx | de-DE       |lblHello.Text   | Hallo (de-DE) 
Default.aspx | en-US       |lblHello.Text   | Hello (en-US) 
Default.aspx | fr-FR       |lblHello.Text   | Bonjour (fr-FR) 
Default.aspx | en          |lblHello.Text   | Hello (en) 
Default.aspx | de-DE       |lblGoodbye.Text | Tschüss (de-DE) 
Default.aspx | en-US       |lblGoodbye.Text | good bye(en-US) 

For some reason (I don't know why) lblHello gets localized correctly, while lblGoodbye does not.

I could also write <asp:label id="lblhello" runat="server" text="<%$ resources: default.aspx, lblhello.text %>" />. This does work too.

In the GetObject method, there is a line for the debugger:

Debug.WriteLine(String.Format(CultureInfo.InvariantCulture, "DBResourceProvider.GetObject({0}, {1}) - type:{2}", resourceKey, culture, this.m_classKey));

If Default.aspx is called by the client this line appears in the output window:

DBResourceProvider.GetObject(lblhello.Text, ) - type:Default.aspx

But there is no call to the DBResourceProvider for lblGoodbye, which is totally weird. As if the new label was not registered, or the meta tag is not been read.