I have an ashx file which returns a localised message. This is called from an Ajax request. I need to access the Asp.net ResourceManager in the ashx file.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Following code worked for me.
HttpContext.GetGlobalResourceObject("classKey", "resourceKey") as string;
回答2:
Any resources in the app should be accessible under the Resources namespace.
For a resource file called LocalMessages.en.resx:
ReturnMsg = Resources.LocalMessages.MyAjaxMessage;
For intellisense to work, make sure app has been compiled once to create the Resources objects from resx files.