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

W

WT

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
 
S

Steven Cheng[MSFT]

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.
 
W

WT

Yes, thats what I was looking for, thanks.
CS
Steven Cheng said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top