I have a strange issue ... I want to retrieve resources programmatically from a SharePoint default resource file wss. So in one of my controls im executing the following code:

 protected override void CreateChildControls()
            LiteralControl literalControl = new LiteralControl();//"<%$Resources:wss,view_selector_view%>");
            string view=SPUtility.GetLocalizedString("$Resources:wss,view_selector_view", "wss", SPContext.Current.Web.Language);
            literalControl.Text = view;


It seems to be ok, and I found examples which use the same way BUT the result I get is not what i want to see: There result is following:


What do i miss?

Update: After investigating the issue, I discorvered that SPUtility doesn't find the wss.resx files, as it is located in 14hive/Resources, BUT it searches in the wwwroot/App_GlobalResrouces ... is it normal that a webcontrol cannot retrieve resources from 14/Resources?

I had to search for another key which would provide me the value, but view_selector_view was a perfect match ... but not accesible as it was in wss.

1 Answer 1


When the key cannot be found in the resource file, the GetLocalizedString method will simply spit back out what you sent it. Which is what you are seeing there.

I'm not positive, but I would try to remove the "wss," from the first parameter in GetLocalizedString. I don't believe it is necessary as the second parameter is specifying the file.

  • Yes, I investigated the log files and it cannot find WSS.resx but it is strange, because it searches for files in 14hive/resources and NOT in App_GlobalResources, why? It is just a webcontrol, shouldn't it retrieve resources from app_globalresources in wwwroot?
    – Shkipper
    Aug 22, 2012 at 5:51
  • Yes the .GetLocalizedString() method will look in the 14/Resources. The resource files in this folder, and this method, more correspond to localizing SharePoint elements rather than your applications. I found this link to be a fairly detailed explanation: platinumdogs.me/2010/08/09/…
    – CMN
    Aug 23, 2012 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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