locked
ResourceManager sometimes "forgets" culture RRS feed

  • Question

  • User-1591584071 posted

    I'm trying to implement a multi-language solution into a website. Currently the website will only be in Dutch. More languages will follow in the future.

    Web.Config:
    <system.web>
      <compilation debug="true"
    />
      <
    globalization culture="nl-NL" uiCulture="nl-NL"
    />
    </system.web>

    Global.asax:
    void Application_OnStart()
    {
    Application[
    "resourceManager"] = ResourceManager.CreateFileBasedResourceManager("Resource", Server.MapPath("App_GlobalResources"), null
    );
    }

    MyPage.aspx.cs:
    protected ResourceManager resourceManager;
    protected void Page_Init(object sender, EventArgs
    e)
    {
    resourceManager = (
    ResourceManager)Application["resourceManager"
    ];
    }

    MyPage.aspx:
    <%=resourceManager.GetString("copyright")%>

    In App_GlobalResources I've created _Resource.nl-NL.resx which I compile into Resource.nl-NL.resources. Most of the time it runs fine, but sometimes I get the following error message: 

    Server Error in '/' Application.

    Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.
    baseName: Resource locationInfo: <null>  fileName: Resource.resources

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.
    baseName: Resource locationInfo: <null>  fileName: Resource.resources

     

    Creating Resource.resources doesn't fix the problem. The error is still shown.

    Does anyone know what I'm doing wrong here?

    Thursday, May 18, 2006 8:18 AM

All replies

  • User-1422796318 posted

    Please help to clarify:

    When the error occurred, how to resolve the problem? Reboot IIS server? Reset IIS service? Or simply access the same page again?

    You can also download FileMon to monitor resource access behavior when the problem occurred again: http://www.sysinternals.com/Utilities/Filemon.html

     

     

    Monday, May 22, 2006 5:26 AM
  • User-1591584071 posted

    The error occurs after editing the web.config file or a .cs file. After editing these files .Net 2.0 buils on the first load, right? The same procedure (editing web.config or a .cs file) solves the problem.

    So after building, the ResourceManager gets the culture, or it doesn't. It seems pretty much random.

    Accessing the resources doesn't seem to be the problem. Understanding the culture is.

    Monday, May 22, 2006 9:28 AM