3

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

HttpContext.GetLocalResourceObject(path, message)

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

1 Answer 1

3

you can't use HttpContext.GetLocalResourceObject instead of that use 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.

Local Resource Files

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.

Sign up to request clarification or add additional context in comments.

1 Comment

The problem is that I have many many web methods and text to be translated. If it all going to be in one file, it would be hard to trace it out. I think Microsoft should make resource files for web services too. Any one Agree with me ? :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.