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?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment

You may subscribe to group Feeds using a RSS Feed Reader to stay upto date 
using following url  

<a href="http://feeds.feedburner.com/DotNetDevelopment";> 
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---

Reply via email to