当我想本地化页面后面的代码时,我会使用它
HttpContext.GetLocalResourceObject(path, message)
我的问题是,有没有办法在 web 服务方法中使用页面的本地资源?
最佳答案
你不能使用 HttpContext.GetLocalResourceObject
而不是使用 HttpContext.GetGlobalResourceObject
Global Resource Files
You create a global resource file by putting it in the reserved folder App_GlobalResources at the root of the application. Any .resx file that is in the App_GlobalResources folder has global scope. Additionally, ASP.NET generates a strongly typed object that gives you a simple way to programmatically access global resources.
本地资源文件
A local resources file is one that applies to only one ASP.NET page or user control (an ASP.NET file that has a file-name extension of .aspx, .ascx, or .master). You put local resource files in folders that have the reserved name App_LocalResources. Unlike the root App_GlobalResources folder, App_LocalResources folders can be in any folder in the application. You associate a set of resources files with a specific Web page by using the name of the resource file.
关于c# - Asp.Net本地化webservice方法中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18229650/