HttpContext.GetGlobalResourceObject始终返回null [英] HttpContext.GetGlobalResourceObject always returns null

查看:825
本文介绍了HttpContext.GetGlobalResourceObject始终返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了两个文件中的文件夹App_GlobalResources文件:

I created two files in the App_GlobalResources folder:

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

同时包含SiteTitleSeparator值。

Both contain a value for "SiteTitleSeparator".

下面就是我试图做(以下行始终返回null):​​

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.

在VB和C#的答案会受到欢迎。

Answers in both VB and C# will be welcomed.

推荐答案

我改变SiteResources.en-US.resx的名称SiteResources.resx,现在一切工作就好了。

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

好像theer必须有一个不变的资源。

Seems theer must be one invariant resource.

这篇关于HttpContext.GetGlobalResourceObject始终返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆