Accessing other resource files in your web application

Using GetLocalResourceObject() to access resource files from other resource objects.
 
I have been doing some work on localising (localizing…no pun intended) a website. One of the issues I have found is that there may be an occassion that I would want to access the resource key from other local resource objects. For example, I can use GetLocalResourceObject("resourceKey1.Text") to get a text value for the current ASPX page that I am working on. I can also use the HttpContext class to access the same resource keys by specifiying HttpContext.GetLocalResourceObject(Page.AppRelativeVirtualPath, "resourceKey1.Text");
 
So, this got me thinking. Can I do the same think to access resource keys for another page using the same method? The answer is, Yes. I just need to replace the Page.AppRelativeVirtualPath with a virtual path to the page I am interested in and look for the relevant resource key in the resource file. For example, HttpContext.GetLocalResourceObject("~/MyFolder/MyPage.aspx", "resourceKey2.Text" ); will find the entry for resourceKey2.Text in the resource file MyPage.aspx.resx in the App_LocalResources folder.

System.MissingMethodException

Method not found: ‘System.Web.UI.IDataSource System.Web.UI.WebControls.DataBoundControl.get_DataSourceObject()’.
 
I got the error above when calling the IPostBackEventHandler.RaisePostBackEvent on a web page running on a server used for testing. Since it wasn’t occuring on any of the development machines then simple logic meant there had to be a difference in the assemblies residing on the server. In this case it was the version of the .Net Framework 3.5 as the server had not had SP 1 installed. Once the machine had been updated the problem was resolved.