Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access GetGlobalResourceObject function from a class that is not a page?

I have a class in my asp.net proj, I would like to get access GetGlobalResourceObject (that page exposes), from anywhere in the site, possible?

In other words I wanna access the global resources from a class that is not a page I don't care how.

like image 549
Shimmy Weitzhandler Avatar asked Jul 10 '09 05:07

Shimmy Weitzhandler


1 Answers

On some farms you'll need to wrap the call to

HttpContext.GetGlobalResourceObject("myResourceKey")

inside a try/catch block to get it over the "Could not find any resources appropriate for the specified culture or the neutral culture" error.

like image 68
jmb_coder Avatar answered Sep 21 '22 19:09

jmb_coder