473,725 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.dl l. 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.CurrentT hread.CurrentCu lture = new
CultureInfo(Ses sion["CultureID"].ToString());
Thread.CurrentT hread.CurrentUI Culture =
Thread.CurrentT hread.CurrentCu lture;

Assembly assembly = Assembly.Load(" myApp");
ResourceManager rm = new ResourceManager ("myApp", assembly);
this.lblCompany ID.Text = rm.GetString("l blCompanyID");

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
resource.
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.Nam eOfWebForm.reso urces, I can't understand where ASP.NET
even matches up resources. There doesn't appear to be any relationship
here.

If I were to create my German resources in a file called
MyNamespace.Nam eOfWebForm.reso urces, 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.dl l 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?

Regards,
Johann Blake
Nov 18 '05 #1
0 2197

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

Similar topics

0
761
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: I've added a few files (images) to an assembly as embedded resources. Within the project folder these files are in a subfolder named "images".
5
4720
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 resources. Before, I built the program using a batchfile and linked the resources with the "/resource:MainFrame.resX" option. Then I loaded them with this code: Assembly myAssembly = Assembly.GetAssembly(this.GetType()); Stream resXStream =...
3
12657
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 language. (en\*.resources, en-US\*.resources ...) With al.exe I generating several dlls with the format applicationname.resource.dll (in every language-folders one dll)
7
1756
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 SDK sub-directory, as instructed by the MSDN. Step 2: I used the 'reseditor' to create a file named "MyResources.resources" that contains only some string resources. Step 3: I added this resource file to my existing test assembly (does not do
1
2292
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 library project) This class call methode : ResourceManager MyAppResourceManager = new ResourceManager("MyAppMain.Resources", Assembly.GetExecutingAssembly()); and I obtain error which tell that there is no propertly added
1
3848
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, string tables, etc.) and place them into a imagelist. I have found examples using the resource manager to create a "resource file" like so: ResourceWriter rw = new ResourceWriter (
4
1736
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 .... but then I don't know I to access single keys and values inside the same .resources file. I'd like to be able to do something like what is possible with the ResourceManager class but I haven't found a way to use it with embedded resources but only...
1
2434
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 of all, VS2005 generates resource wrappers as internal, so we have to use InternalsVisibleTo to make intellisense etc possible for resources. Then, with this model, all the cool localization features of ASP.NET 2.0 are not possible. Is there any...
8
2455
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 embedded resource, I can't run it anymore because I got an error on 'WindowsApplication1.Form1.Dispose(bool)'..
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.