how can i read a key from App_GlobalResources files ?

You want to read data from App_GlobalResources,

you can try to use ResourceManager class for help.

Please check the following code:

 

Type type = typeof(System.Web.Compilation.BuildManager);

PropertyInfo propertyInfo = type.GetProperty("AppResourcesAssembly", 
BindingFlags.Static | 
BindingFlags.GetField | 
BindingFlags.NonPublic);

Assembly assembly = (Assembly) propertyInfo.GetValue(null, null);

string[] names = assembly.GetManifestResourceNames();
string resource = names[0];
string baseName = resource.Substring(0, resource.LastIndexOf('.'));

ResourceManager manager = new ResourceManager(baseName, assembly);

ResourceSet resources = manager.GetResourceSet(
System.Globalization.CultureInfo.CurrentCulture, true, true); 

IDictionaryEnumerator enumerator = resources.GetEnumerator();

while (enumerator.MoveNext())
{
string key = (string) enumerator.Key;
string value = (string)enumerator.Value;
}
http://www.velocityreviews.com/forums/t519773-appglobalresources-list-all-strings.html
http://jiricapeksharepoint.blogspot.com/2008/11/read-resource-string-from.html

Let me know whether that answers your questions, or if I've missed something.
posted @ 2009-06-26 12:34  永不言败  阅读(242)  评论(0编辑  收藏  举报