Broodmdh
February 6th, 2008, 10:15 AM
I am trying to convert my ASP .NET 1.1 (VB) app to 2.0, but I'm having a lot of trouble with the resource files. I placed them in the App_LocalResources folder (maintaining the sub-folder structure that we already had in place), and I am using the following code to try and access them:
Dim gStr As ResourceManager
gStr = New ResourceManager("LSI." & newPageName, [Assembly].GetExecutingAssembly)
gStr.GetString("PageTitle", ci)
This doesn't return anything (just an empty string).
I've also tried the following:
ctrl1.Text = Me.GetLocalResourceObject("PageTitle").ToString()
This, unfortunately, doesn't work and throws the following error:
"The resource class for this page was not found. Please check if the resource file exists and try again.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code."
The resource files have a build action of "Content", and not "Embedded Resource", but I don't know if this is right. I've tweaked everything so many times I don't know what else to do. I've also tried using gStr.GetString("PageTitle", ci), but that just throws a "Could not find any resources appropriate for the specified culture or the neutral culture" error.
I've read that the resource files have to be at the same level as the page they are related to, but that hasn't worked for me either. I'm setting all of this in a base class that is inherited by all the pages in the app, and I don't know if that makes a difference. This whole process is very frustrating, especially because I am operating on a very tight timeframe. Any help would be appreciated.
Dim gStr As ResourceManager
gStr = New ResourceManager("LSI." & newPageName, [Assembly].GetExecutingAssembly)
gStr.GetString("PageTitle", ci)
This doesn't return anything (just an empty string).
I've also tried the following:
ctrl1.Text = Me.GetLocalResourceObject("PageTitle").ToString()
This, unfortunately, doesn't work and throws the following error:
"The resource class for this page was not found. Please check if the resource file exists and try again.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code."
The resource files have a build action of "Content", and not "Embedded Resource", but I don't know if this is right. I've tweaked everything so many times I don't know what else to do. I've also tried using gStr.GetString("PageTitle", ci), but that just throws a "Could not find any resources appropriate for the specified culture or the neutral culture" error.
I've read that the resource files have to be at the same level as the page they are related to, but that hasn't worked for me either. I'm setting all of this in a base class that is inherited by all the pages in the app, and I don't know if that makes a difference. This whole process is very frustrating, especially because I am operating on a very tight timeframe. Any help would be appreciated.