Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Using Resource Files - not for localization

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Mell - 24 Jul 2007 16:01 GMT
I would like to use compiled resource files in my web application that are
not related to localization.
The idea is to have a dll with resources that can be accessed by the
website.

I have no problem making the dll.
I am running into problems using it.

I am attempting to use the resource manager to get the values from the dll
and update the controls appropriately.

When I try to use it, I get a MissingManifestResourceException error saying
Could not find any resources appropriate for the specified culture (or the
neutral culture) on disk.

How can I avoid this?

Thanks,
Bill Mell
Sergey Poberezovskiy - 25 Jul 2007 06:56 GMT
Bill,

Not sure of your setup and why you get those errors.
I can tell you the way I use resources - see whether it works for you.
- In your dll set BuildAction for the files to "Embedded Resource"
- inside your dll define a function that would return the resource,
something similar to the following:
using System;
using System.IO;
using System.Reflection;
...
public class MyDllClass{
...
private static Assembly _asm = Assembly.GetExecutingAssembly();
private static Type _localType = typeof(MyDllClass);
...
public static Stream GetResource(string location, string name)
{
  return _asm.GetManifestResourceStream(_localType, location + "." + name);
}

if your resource files are grouped in a folder - you would specify the
folder name in location parameter, otherwise pass empty string. Note that
resource name is case-sensitive.

If you program in VB, I believe that you do not specify the location - it
does not create a namespace for folders.

To get a string from your Stream, use
 new StreamReader(stream).ReadToEnd();

Hope this helps

> I would like to use compiled resource files in my web application that are
> not related to localization.
[quoted text clipped - 15 lines]
> Thanks,
> Bill Mell

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.