Unlike Global Resources, Local Resources items from ASP.NET can be accessed only with GetLocalResouceObject method which can take as parameter a string key of the resource item.
So, the default functionality does not support strongly typed access to the resource items.
Here are the steps to obtain strongly typed local resources:
- Add the App_LocalResource folder to your solution;
- Add a new resource file to App_LocalResource folder;
- Add some keys to the resource file;
- Change the Access Modifier of the resource file to public;
- Right click on the resource file, then select Properties and from the Build Action dropdown select Embedded Resource;
After you have followed the above steps you should be able to access the local resource items like this:
Don’t worry about the resource files that contain the language codes in their names. It will automatically take the file according to the defined culture in your code.
You can download a demo application with strongly typed local resources from below.