472,993 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Locating and matching resources in embedded and external resource files

I'm having trouble grasping how ASP.NET correctly locates resources.
There is plenty of documentation on this subject but some things are
not clear at all.

In my ASP.NET application, I have multiple web forms. When you compile
the application, it creates a DLL. If you view this DLL using ILDASM
(the manifest), it shows info about the resources stored in the DLL.
There is essentially an embedded resource "section" for each web form.
The namespace used in each web form plays an important name in how the
resource is named in the manifest. I call this a "section" because it
is obviously referring to where the resources are located and not the
actual resources stored there.

At this point, the resources stored in the DLL are the "embedded
resources". The default culture ID for the resources in the DLL is
english US (en-US). The name of the DLL is myApp.dll.

I also have an additional DLL that contains what I believe should be
the resources translated over into German. The name of DLL resource
file is
myApp.de-DE.resources.dll. I say "believe" because I have no way of
actually seeing the IDs of the resources in the original DLL. I assume
that Visual Studio.NET uses the name of the controls found on the web
forms as the ID in the resource. So I used these names as well as IDs
in the German resource file.

Finally, following the rules spelled out by Microsoft in their online
documentation, you create subdirectories within the bin directory for
resources and store the corresponding resource there.

To read resources within the web form I do the following:

Thread.CurrentThread.CurrentCulture = new
Thread.CurrentThread.CurrentUICulture =

Assembly assembly = Assembly.Load("myApp");
ResourceManager rm = new ResourceManager("myApp", assembly);
this.lblCompanyID.Text = rm.GetString("lblCompanyID");

I store the culture ID in the session and use it to set the current
culture so that the correct resource will get loaded.

When the culture is set to "de-DE", it will in fact load the correct
But when I set the culture to "en-US", it cannot find the resource. I
really can't really understand why it even should find the resource.
If the manifest indicated that resource in the english manifest was
MyNamespace.NameOfWebForm.resources, I can't understand where ASP.NET
even matches up resources. There doesn't appear to be any relationship

If I were to create my German resources in a file called
MyNamespace.NameOfWebForm.resources, it might work. But wait a second.
Is this to imply that for every web form there must be a corresponding
external resource file for the language you want to support? This
doesn't make any sense. I thought that it was possible to store all
resources for the entire ASP.NET application in one resource file
myApp.de-DE.resources.dll and ASP.NET will take care of locating the
corresponding resource in whatever resource is stored in the default
manifest. And since there are multiple resource sections in the
default assembly, doesn't it make sense that ASP.NET will know where
to look?

Johann Blake
Nov 18 '05 #1
0 2137

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

Similar topics

by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: ...
by: Marcus Ahlberg | last post by:
I've been coding a C# project in "pure code" and I would now want to import it into VS.net. I have created a project and imported all sourcefiles and it's compiling without problems, except for the...
by: Jesse | last post by:
Hi together, I've a problem with compiling an application with a build-Script and run it after. Several resource-files I compile with resgen.exe and put the files into a folders of the...
by: Ken Allen | last post by:
OK, for a number of reasons I have needed to begin experimenting with resources sooner than I had planned (I had avoided it for now). Step 1: I built the 'reseditor' application that is in the...
by: Stefan Turalski \(stic\) | last post by:
Hi, What I need to do is adding some support for resources files to my application. What I did is: MyAppMain <- startup project MyAppHelper <- project which has MyAppResourcesClass (al a...
by: D. Yates | last post by:
Hi, I am looking for an example of how to extract bitmap images from an embedded resource file (a file with *.res extension, which can be viewed inside of the ide and can hold bitmaps, icons,...
by: Bob Rock | last post by:
Hello, I'd like to programmatically access keys and values of on .resources file embedded in my assembly. I've seen that the assembly class provides the GetManifestResourceStream method .......
by: Sergei Shelukhin | last post by:
Hi. We have a resource assembly that is separate and is used by a class library assembly, a web app, web service set (all in separate projects). Windows app is also potentially possible. First...
by: Fred* | last post by:
Hello, I'm using Visual C# 2005 Express. if I create a new "application windows" project and run it (F5), it works well. (an empty window is launched..) as soon as I set the build action to...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.