Edit
My answer below is incorrect as indicated in the comments. You can get a ResXResourceProviderFactory using reflection as follows.
IResourceProvider resxProvider; string typeName = "System.Web.Compilation.ResXResourceProviderFactory, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; ResourceProviderFactory factory = (ResourceProviderFactory)Activator.CreateInstance(Type.GetType(typeName)); resxProvider = factory.CreateGlobalResourceProvider(classKey);
(A similar method to get the local resource provider.)
Then, to get the resource, you just need to call GetObject:
object resource = p.GetObject("ResourceKey", new System.Globalization.CultureInfo("en"));
You can use GetGlobalResourceObject and GetLocalResourceObject (part of the HttpContext class) to work with .ResX files in your custom localization classes.
For example, to get a resource called "ResourceKey" from "MyResxFile.resx" (in * App_GlobalResources *), for the current culture, you should use this:
HttpContext.GetGlobalResourceObject( "MyResxFile", "ResourceKey", System.Threading.Thread.CurrentThread.CurrentCulture );
Mcgarnagle
source share