Getting localized text without loading assembly?

Last post 05-14-2008 8:55 PM by vivek_iit. 3 replies.

Sort Posts:

  • Getting localized text without loading assembly?

    05-13-2008, 10:50 AM
    • navinpc
    • Joined on 05-13-2008, 2:21 PM
    • Posts 2

    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?

       

     
  • Re: Getting localized text without loading assembly?

    05-13-2008, 8:25 PM
    • Loading...
    • vivek_iit
    • Joined on 06-18-2006, 6:13 PM
    • New Delhi
    • Posts 3,072
    • TrustedFriends-MVPs

     which asp.net version are you using? its different in 1.1 and 2.0 and above.

    MVP, ASP.NET || My Website || Blog || Articles

    Please mark the most helpful reply/replies as "Answer".
  • Re: Getting localized text without loading assembly?

    05-14-2008, 4:16 AM
    • navinpc
    • Joined on 05-13-2008, 2:21 PM
    • Posts 2

    I am using ASP.Net version 1.1 .

  • Re: Getting localized text without loading assembly?

    05-14-2008, 8:55 PM
    • Loading...
    • vivek_iit
    • Joined on 06-18-2006, 6:13 PM
    • New Delhi
    • Posts 3,072
    • TrustedFriends-MVPs

     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.

    -Vivek 

    MVP, ASP.NET || My Website || Blog || Articles

    Please mark the most helpful reply/replies as "Answer".
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter