I have a resx file in App_GlobalResources in my web application, called with
Resources.GetResource("ResourceFileName", "Resource")
The helper method lives in a separate class library to get resource values:
using System.Resources;
using System.Web;
public static class Resources
{
public static string GetResource(string resource, string key)
{
try
{
string resourceValue = (string)HttpContext.GetGlobalResourceObject(resource, key);
return string.IsNullOrEmpty(resourceValue) ? string.Empty : resourceValue;
}
catch (MissingManifestResourceException)
{
return string.Empty;
}
}
}
If I press F5, everything will be fine. If I deploy to a web server, all calls to GetGlobalResourceObject will return as null.
Resources exist. How to get them?
Thank,
Richard
source
share