SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer
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 '12 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:… – CMN Aug 23 '12 at 1:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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