473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to use .RESX or .RESOURCE to retrieve list of strings

I have a web service that needs to return a particular string for one
of its web methods. I would like to manage the strings in a resource
file. I went through a lot of the help provided on the net and can't
seem to get it to work.

Can someone with expertise assure me this is possible as a Web Service
(using C#)?
If so, can someone provide the steps on how to get this working?

Aug 21 '07 #1
7 12260
By the way, I'm doing this through Visual Studio 2005. I hear
that .RESX files are handled by the IDE and don't need to run
RESGEN.exe separately.

Aug 21 '07 #2
On Aug 21, 1:34 pm, nws_rea...@yahoo.com wrote:
By the way, I'm doing this through Visual Studio 2005. I hear
that .RESX files are handled by the IDE and don't need to run
RESGEN.exe separately.
You need to use the ResourceManager class, see if this link gets you
started..

http://www.sliver.com/dotnet/articles/resinweb.aspx

Ron

Aug 21 '07 #3
Thanks for your response. ResourceManager is something I'm struggling
with.
The link you provided, and other sites I've found seem to be targeting
Web applications, not web services, or not 2005 web services.
>From the link you provided
>ResourceManager rm = new ResourceManager("MyApplication.res", Assembly.GetExecutingAssembly())
What is considered to be "MyApplication" when I have a web service and
not a web app. I tried the name of the project, the namespace, the
class ... nothing works. I always get the following error

"Could not find any resources appropriate for the specified culture or
the neutral culture"

Any ideas?
You need to use the ResourceManager class, see if this link gets you
started..

http://www.sliver.com/dotnet/articles/resinweb.aspx

Ron


Aug 21 '07 #4
On Aug 21, 5:39 pm, nws_rea...@yahoo.com wrote:
Thanks for your response. ResourceManager is something I'm struggling
with.
The link you provided, and other sites I've found seem to be targeting
Web applications, not web services, or not 2005 web services.
From the link you provided
ResourceManager rm = new ResourceManager("MyApplication.res", Assembly.GetExecutingAssembly())

What is considered to be "MyApplication" when I have a web service and
not a web app. I tried the name of the project, the namespace, the
class ... nothing works. I always get the following error

"Could not find any resources appropriate for the specified culture or
the neutral culture"

Any ideas?
You need to use the ResourceManager class, see if this link gets you
started..
http://www.sliver.com/dotnet/articles/resinweb.aspx
Ron
MyApplication is the name of the resource that resides in the DLL.
For a DLL, not sure about using Assembly.GetExecutingAssembly(),
another alternative is to use a object type that is defined in the
same DLL as the resources. e.g.

ResourceManager rm = new ResourceManager("MyApplication.res",
typeof(objectInDll).Assembly)

I sometimes create a wrapper object around the resources and place it
in the same DLL, and actually use it as the object in the 'typeof'.

A possibly easier method is to add a Resource RESX file to your DLL
project. This will create a resx file such as Resource1.resx, and
also a designer file such as Resource1.Designer.cs. Add some strings
to the RESX file via the Designer, and then if you right click on the
designer file and click on Code, you will see a generated class that
provides a wrapper and accessors for the strings that you have added.
This should hopefully serve as an example also.

Ron

Aug 22 '07 #5
Thanks again for your response. It looks like I need to do more
reading about the different flavors of web services that can be
created with VS 2005 (I'm a newbie).

I created a project using "File, New, Web Site ..." and chose the
"ASP .NET Web Service" template. This project does not create a DLL
as opposed to using "File, New, Project ...". However, I'm able to
deploy it to the 2003 server and have an application add a reference
to it and use it. The deploying process is done by copying the .asmx
and web.config file and other files in the App_Code folder.

Can I still use resources from a .RESX file in this scenario?
MyApplication is the name of the resource that resides in the DLL.
For a DLL, not sure about using Assembly.GetExecutingAssembly(),
another alternative is to use a object type that is defined in the
same DLL as the resources. e.g.

ResourceManager rm = new ResourceManager("MyApplication.res",
typeof(objectInDll).Assembly)

I sometimes create a wrapper object around the resources and place it
in the same DLL, and actually use it as the object in the 'typeof'.

A possibly easier method is to add a Resource RESX file to your DLL
project. This will create a resx file such as Resource1.resx, and
also a designer file such as Resource1.Designer.cs. Add some strings
to the RESX file via the Designer, and then if you right click on the
designer file and click on Code, you will see a generated class that
provides a wrapper and accessors for the strings that you have added.
This should hopefully serve as an example also.

Ron- Hide quoted text -

- Show quoted text -

Aug 22 '07 #6
On Aug 22, 10:48 am, nws_rea...@yahoo.com wrote:
Thanks again for your response. It looks like I need to do more
reading about the different flavors of web services that can be
created with VS 2005 (I'm a newbie).

I created a project using "File, New, Web Site ..." and chose the
"ASP .NET Web Service" template. This project does not create a DLL
as opposed to using "File, New, Project ...". However, I'm able to
deploy it to the 2003 server and have an application add a reference
to it and use it. The deploying process is done by copying the .asmx
and web.config file and other files in the App_Code folder.

Can I still use resources from a .RESX file in this scenario?
MyApplication is the name of the resource that resides in the DLL.
For a DLL, not sure about using Assembly.GetExecutingAssembly(),
another alternative is to use a object type that is defined in the
same DLL as the resources. e.g.
ResourceManager rm = new ResourceManager("MyApplication.res",
typeof(objectInDll).Assembly)
I sometimes create a wrapper object around the resources and place it
in the same DLL, and actually use it as the object in the 'typeof'.
A possibly easier method is to add a Resource RESX file to your DLL
project. This will create a resx file such as Resource1.resx, and
also a designer file such as Resource1.Designer.cs. Add some strings
to the RESX file via the Designer, and then if you right click on the
designer file and click on Code, you will see a generated class that
provides a wrapper and accessors for the strings that you have added.
This should hopefully serve as an example also.
Ron- Hide quoted text -
- Show quoted text -
Probably can't use the .RESX file in this scenario. You could
possibly create a separate DLL and then access from your other code,
but generally developers will try to avoid deploying source on the web
server and instead deploy dlls.

Check out add-in for VS2005 that will pre-compile the entire web
project to one more DLLs. Here are some details on it..

http://weblogs.asp.net/scottgu/archi...06/429723.aspx

Check out the add-in for Web Application projects also, this has been
helpful

http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

Ron

Aug 22 '07 #7
I'm going to have to publish the web site so I can work with a DLL. I
guess I'll have to deal with the local debugging by creating the DLL
locally too. Thanks for your help!

Aug 22 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Scott Emick | last post by:
I need a way either using active directory or otherwise in VB .NET (API's are fine) to retrieve the list of IP addresses and MAC addressses from our DHCP server here. I specifically need to do...
2
by: Bj?rn | last post by:
HY, my problem is the following: I want to give a very big application the ability, to change the language at runtime. It's written in Visual C++ 6.0. All language depending strings and so...
0
by: Kathy | last post by:
I have written queries against the MSysObjects table in the past to retrieve a list of the queries within a database. In Access 2000, I want to expand that capability to query a list of query...
1
by: William Oliveri | last post by:
Hi all, I"ve been trying to retrieve the names of each selected items in a Datalist. So I've been trying to loop through each entry in the datalist to retrieve the name of each entry. I...
0
by: Brian Henry | last post by:
Since no one else knew how to do this I sat here all morning experimenting with this and this is what I came up with... Its an example of how to get a list of items back from a virtual mode list...
3
by: JimCinLA | last post by:
I use a place holder to load different user controls on an .aspx page. Let's call this default.aspx. Each user controls contains about a dozen different ASP.Net controls. My question is, how...
0
by: Piotrekk | last post by:
Hi I have set Localization = true and added proper *.resx file to the project ( by adding proper language ). This file contains simple string. Then in the code: ...
0
by: Galen Somerville | last post by:
I'm not using Cultures so I just want to pull strings out of a Resource dll. In References there is a reference to the CDS80Eng.dll Partial code in a module --------------- Public Function...
0
by: c0mrade | last post by:
I have a problem with getting the list items, below is my hibernate code, after that code there is my method ..and below that is my junit test. How can I make sure that query is executing properly,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.