Web服务方法中文本的​​Asp.Net本地化 [英] Asp.Net localization of text in webservice method

查看:52
本文介绍了Web服务方法中文本的​​Asp.Net本地化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想对页面后面的代码进行本地化时,我会使用此

When I want to localize code behind of page I use this

HttpContext.GetLocalResourceObject(path, message)

我的问题是,有没有办法在webservice方法中使用页面的本地资源?

My question is that, is there a way to use local resources of page inside webservice methods?

推荐答案

您不能使用 HttpContext.GetLocalResourceObject 而不是使用

you can't use HttpContext.GetLocalResourceObject instead of that use HttpContext.GetGlobalResourceObject

全局资源文件

通过将全局资源文件放入保留文件夹中来创建该文件App_GlobalResources位于应用.App_GlobalResources文件夹中的任何.resx文件具有全球范围.此外,ASP.NET生成强类型对象,为您提供一种以编程方式访问全局的简单方法资源.

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.

本地资源文件

本地资源文件是仅适用于一个ASP.NET页面或用户控件的文件(具有.aspx,.ascx或.master的文件扩展名).你把地方具有保留名称的文件夹中的资源文件App_LocalResources.与根App_GlobalResources文件夹不同,App_LocalResources文件夹可以位于应用程序中的任何文件夹中.您通过以下方式将一组资源文件与特定的网页相关联:使用资源文件的名称.

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.

这篇关于Web服务方法中文本的​​Asp.Net本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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