c# - Asp.Net本地化webservice方法中的文本

标签 c# asp.net web-services

当我想本地化页面后面的代码时,我会使用它

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/

相关文章:

c# - VB.Net VBDateTimePicker (可空日期时间选择器)

c# - 在 C# 中快速解析 PHP

c# - 使用 DataTable 插入或更新 SQL 表

c# - 当搜索没有结果时抛出一个弹出窗口

azure - 为什么 Azure ASP(应用服务计划)手动扩展太慢?

c# - 无法在 Visual Studio 中使用 WSDL 添加服务引用

c# - 如何用堆栈添加大数?

c# - 如何从我的 asp.net 应用程序注销用户?

web-services - 不同类型的网络服务

android - 使用 HttpGet 返回完整的 HTML 代码