Localisation with RESOURCE: in aspx pages need resx files no dll

Discussion in 'ASP .Net' started by WT, Apr 30, 2007.

  1. WT

    WT Guest

    Hello,

    Could we use 'Embedded resources' with resx files that contain text
    resources used in aspx pages with the syntaxe:
    Text="<%$ Resources:ResourcesMy,KEY1 %>"



    I tryed removing the App_GlobalResources folder, and after verifying thta my
    resources were correctly embedded in my dll, I get errors as if asp.net was
    unable to look for these ressources in the assembly, still trying to open an
    resx file

    InitializeDataSourceLoadControl controlPath :
    /WTPageModules/Pages/PortalPagesManager.ascx, ex :
    System.Web.HttpParseException: The resource object with key 'AM_TABS' was
    not found. --->
    System.Exception: The resource object with key 'AM_TABS' was not found. --->
    System.Web.HttpException: The resource object with key 'AM_TABS' was not
    found.

    Is there any solution to have dlls and no resx files deployed ?



    Thanks

    CS
     
    WT, Apr 30, 2007
    #1
    1. Advertising

  2. Hi CS,

    From your description, what you want to do is using the localization
    resources defined in a class library assembly(rather than the
    App_LocalResource or App_GlobalResource) in your ASP.NET 2.0 page, correct?

    Based on my understanding, ASP.NET 2.0 web page's localization directive
    (<%$Resource %>) can only reference resource items defined in either
    App_LocalResource or App_GlobalResource's resource files. To use resource
    items in a separate .net assembly, you may need to manually load the
    resource through resource API(such as resourceManager ...)

    http://msdn2.microsoft.com/en-us/library/aa309403(VS.71).aspx

    Also, for ASP.NET 2.0 application, if you perform precompilation for your
    web application, those resource files in App_GlobalResource and
    App_LocalResource can be precompiled into assemblies. Is this possible to
    help avoid using separate assembly to store resource?

    In addition, if you do have to store resource in class library, you can
    consider create a custom expression build that encapsulate the code logic
    of retrieving resource from external resource file or assembly and use your
    custom expression in ASPX template. here is a msdn article introducing this:

    #Extending the ASP.NET 2.0 Resource-Provider Model
    http://msdn2.microsoft.com/en-us/library/aa905797.aspx

    And another good article about custom expression builder in ASP.NET 2.0:

    #The CodeExpressionBuilder
    http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-CodeExpressionB
    uilder.aspx

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], May 1, 2007
    #2
    1. Advertising

  3. WT

    WT Guest

    Yes, thats what I was looking for, thanks.
    CS
    "Steven Cheng[MSFT]" <> a écrit dans le message
    de news: ...
    > Hi CS,
    >
    > From your description, what you want to do is using the localization
    > resources defined in a class library assembly(rather than the
    > App_LocalResource or App_GlobalResource) in your ASP.NET 2.0 page,
    > correct?
    >
    > Based on my understanding, ASP.NET 2.0 web page's localization directive
    > (<%$Resource %>) can only reference resource items defined in either
    > App_LocalResource or App_GlobalResource's resource files. To use resource
    > items in a separate .net assembly, you may need to manually load the
    > resource through resource API(such as resourceManager ...)
    >
    > http://msdn2.microsoft.com/en-us/library/aa309403(VS.71).aspx
    >
    > Also, for ASP.NET 2.0 application, if you perform precompilation for your
    > web application, those resource files in App_GlobalResource and
    > App_LocalResource can be precompiled into assemblies. Is this possible to
    > help avoid using separate assembly to store resource?
    >
    > In addition, if you do have to store resource in class library, you can
    > consider create a custom expression build that encapsulate the code logic
    > of retrieving resource from external resource file or assembly and use
    > your
    > custom expression in ASPX template. here is a msdn article introducing
    > this:
    >
    > #Extending the ASP.NET 2.0 Resource-Provider Model
    > http://msdn2.microsoft.com/en-us/library/aa905797.aspx
    >
    > And another good article about custom expression builder in ASP.NET 2.0:
    >
    > #The CodeExpressionBuilder
    > http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-CodeExpressionB
    > uilder.aspx
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > ==================================================
    >
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    >
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    >
    >
     
    WT, May 2, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Steele [MVP]

    Re: Resx Vs Resource Vs Text File

    Patrick Steele [MVP], Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    515
    Patrick Steele [MVP]
    Jul 16, 2003
  2. Hans Kesting

    what are aspx.resx files for?

    Hans Kesting, Feb 9, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    9,354
    Hans Kesting
    Feb 19, 2004
  3. John M
    Replies:
    1
    Views:
    1,309
    Kumar Reddi
    May 29, 2005
  4. Rahul
    Replies:
    0
    Views:
    1,095
    Rahul
    Nov 28, 2006
  5. Replies:
    0
    Views:
    317
Loading...

Share This Page