Under App_LocalResources, you have your own resource files that are not mapped to the page.
master.resx
I'd like to load this with C# and get the string inside. Is there a way?
The reason why I want to put it under App_LocalResources is because I want to make it editable after release as a string without embedding it in the DLL.I don't want to use the configuration file for this purpose.
c# .net asp.net
Can I use App_GlobalResources
instead of App_LocalResources
? I understood that both are treated the same way and are page-specific or shared across the board.
I think it's wrong as an approach to browse page-specific resources from another page.
This is not a very recommended method, but you can parse the resx file using the ResXResourceSet
class by adding System.Windows.Forms.dll to the reference.
new System.Resources.ResXResourceSet(Server.MapPath("App_LocalResources/master.resx")).GetString("String1")
In the above example, ResXResourceSet
is created every time, but if you want to use it on a web server, you need to cache it appropriately.
© 2024 OneMinuteCode. All rights reserved.