Last post May 14, 2008 08:55 PM by vivek_iit
May 13, 2008 10:50 AM|navinpc|LINK
I have to programmatically get localized text in an ASP.Net application. The text is there in the resource file of the same assembly. I have written the following code for the same:
1 Assembly a = Assembly.Load("MyAssembly");
2 ResourceManager rm = new ResourceManager("MyAssembly", a);
3 Response.Write(rm.GetString("msg", Thread.CurrentThread.CurrentCulture));
In the first the line of the above code I am explicitly loading the assembly, which is perhaps not an optimal solution.
Is there any alternate way to get the localized text without explicitly loading the assembly?
May 13, 2008 08:25 PM|vivek_iit|LINK
which asp.net version are you using? its different in 1.1 and 2.0 and above.
May 14, 2008 04:16 AM|navinpc|LINK
I am using ASP.Net version 1.1 .
May 14, 2008 08:55 PM|vivek_iit|LINK
In 1.1 that is the only way to load resources. But in 2.0 you can directly use ResourceManager as ASP.NET handles rest of the work.