Over a million developers have joined DZone.

Loading Resources Programmatically

DZone's Guide to

Loading Resources Programmatically

Free Resource
// load resources at runtime from resx files

// retrieves value of MyResourceKey from ResourceFile.resx located in App_GlobalResources folder

msg1.Text = (string) HttpContext.GetGlobalResourceObject("ResourceFile", "MyResourceKey");

// retrieves value of Page1Resource.Title key from Page1.resx file located in App_LocalResources folder
// in directory pointed by virtual path /MyFolder/Sample/

msg1.Text = (string) HttpContext.GetLocalResourceObject("/MyFolder/Sample/Page1.resx", "Page1Resource.Title");

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}