Load Resource File By Code RRS feed

  • Question

  • Hello ,

     -  I have a SharePoint Site .

     - I have a Resource file . And I put it in teh following path :

    - I Create a Custom WebPart . in The Code I Load the  resource file by the following Line :

             " public static ResourceManager ResourceManager = new ResourceManager(String.Format(@"C:\Inetpub\wwwroot\wss\VirtualDirectories\1010\App_GlobalResources\SiteMapResources.resx", BaseName), Assembly.GetCallingAssembly());"

    but it gives me this Exception :
      "Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "C:\Inetpub\wwwroot\wss\VirtualDirectories\1010\App_GlobalResources\SiteMapResources.resx.resources" was correctly embedded or linked into assembly "SiteMapCustomWebPart" at compile time, or that all the satellite assemblies required are loadable and fully signed."

    So how CanIsove ths Issue?


    Wednesday, December 23, 2009 7:47 AM


  • Why you are using this place to storage your resource files?

    SharePoint have own place for resources: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources

    So resource strings from SharePoint resources you will get with following method:


            public static string GetResourceString(string key, uint lang)
                string resourceText = SPUtility.GetLocalizedString(
                    "$Resources:" + key,
                if (resourceText.StartsWith("$Resources:"))
                    // resource with this key not found
                return resourceText;
    Wednesday, December 23, 2009 9:27 AM