MissingManifestResourceException when attempting to retrieve resource file value

21 views
Skip to first unread message

wardy

unread,
Oct 15, 2008, 11:23:20 AM10/15/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi all,

I have a VS2008 .NET 3.5 web application, in C#, in which I am trying
to retrieve the value of a resource file into a variable in code. I
have scoured the web trying to find a solution to my issue, but so far
nothing has solved my issue.

I have a simple web application, with one web page, Default.aspx, for
which I have added a global resource file, Default.aspx.resx (I tried
under both the App_GlobalResources and App_LocalResources folders),
which has one entry in it, TestValue. All I am trying to do is
retrieve the text value of the key TestValue from that resource file
in code, using the following:

// specify the resource file name
string resourceFile = "Default.aspx";
// get the path of your file
string filePath =
System.AppDomain.CurrentDomain.BaseDirectory.ToString();
// create a resource manager for reading from the resx file
ResourceManager resourceManager =
ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath,
null);
// retrieve the value of the specified key
sResourceValue = resourceManager.GetString("TestValue");

The problem is, whenever I run this code, I always get the error:

Could not find any resources appropriate for the specified culture (or
the neutral culture) on disk.\r\nbaseName: Default.aspx locationInfo:
<null> fileName: Default.aspx.resources

I am using the file system option as my development web server (not
IIS). This is an extremely simple attempt to use resource files, so
I'm pretty stumped as to why this doesn't work....anyone have any
thoughts?
Reply all
Reply to author
Forward
0 new messages