asp.net global resources error 'The resource object with key '' was not found'

…衆ロ難τιáo~ 提交于 2019-12-05 07:44:40

The format of resource files are ResourceName.culture.resx

Create a resource file in the App_GlobalResources folder called Main.resx. This is for the default culture ( ie Invariant )

Then create a resource file Main.en-US.resx

This is where all the resources for en-US culture will live, and so on.

Main.resx  
Main.en.resx  
Main.en-US-resx  
Main.en-AU.resx  
Main.fr.resx  
Main.fr-FR.resx  

etc.

To access this from the webpage use the syntax

<%$ Resources:Main, Email %>

Don't worry around the culture, the system will work it out. It will exact match first ( en-US ), then work up to that's cultures parent ( en ), parent's parent ( Invariant ).

Change the name of "Main" to suit your needs

Mitul
  1. Change your file name to en-US.aspx.resx and try again. See this helps.
  2. Try changing the build actions and see what happens. See here
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!