HttpContext.GetGlobalResourceObject always returns null

和自甴很熟 提交于 2019-12-07 12:03:38

问题


I created two files in the App_GlobalResources folder:

SiteResources.en-US.resx
SiteResources.sp-SP.resx

Both contain a value for "SiteTitleSeparator".

Here is what I am trying to do (The following line always returns null):

string sep = (string)GetGlobalResourceObject("SiteResources", "SiteTitle");

Note, that the Culture property on the page is set.

Answers in both VB and C# will be welcomed.


回答1:


I changed the name of SiteResources.en-US.resx to SiteResources.resx and now everything works just fine.

Seems theer must be one invariant resource.




回答2:


Yes: there has to be one .resx without a region code which will serve as a default.



来源:https://stackoverflow.com/questions/1082846/httpcontext-getglobalresourceobject-always-returns-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!