Doubt on Multilingual application

  • Thread starter Thread starter amitmnagarwal
  • Start date Start date
A

amitmnagarwal

I am using the following code to access the resourc file.

Dim sAssembly As [Assembly]
sAssembly = [Assembly].GetExecutingAssembly()

Dim rm As New ResourceManager("MultiLingual.Info",
sAssembly)

''Case sensitive
Response.Write(rm.GetString("Test"))
Response.Write("<br><br>" & rm.GetString("Test1"))

This code would reside in a common place where the whole application
would require the info from the resource file.

I wanted to know that if i create the instance of the resourcemanager
at application level in the application start event and let the code
reference the application object.

This would avoid callling the above code repeatedly

Please advice
 
Probably not a good idea because more than one thread might try to use
you ResourceManager object at the same time, so you could run into
concurrency problems.
 
When localizing ASP.NET web applications, you should use

<%$ Resources: .... %> expressions in markup,
Resources (generated namespace),
HttpContext.GetGlobalResourceObject() method (available also in Page)
and HttpContext.GetLocalResourceObject() method (available also in Page).

There is usually no need to use ResourceManager.

Robert Haken [MVP ASP/ASP.NET]
HAVIT, s.r.o., www.havit.cz
http://knowledge-base.havit.cz
 
Back
Top