Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Howto to use resources from System.Web?

Thread Tools

Howto to use resources from System.Web?

Posts: n/a
I am using the ContentTemplate to extend the CreateUserWizard's
CreateUserWizardStep with additional controls. For the CreateUserWizardStep
labels, I would like to keep the automatic localization.
With Lutz Roeder's .Net Reflector, I found out that System.Web contains the
text resource System.Web.Resources and I found e.g. the name/value-pair
CreateUserWizard_DefaultUserNameLabelText=User Name:

My question here is: how can I bind this resource entry to the label?

I tried adding
Text="<%$ Resources:System.Web.resources,
CreateUserWizard_DefaultUserNameLabelText %>
to the asp:Label but I get the error message:
Parser error. The resource object with key
'CreateUserWizard_DefaultUserNameLabelText' was not found.

<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName"
Text="<%$ Resources:System.Web.resources,
CreateUserWizard_DefaultUserNameLabelText %>" /></td>

Any help would be greatly appreciated.
Reply With Quote
Steven Cheng[MSFT]
Posts: n/a
Hello Dieter,

From your description, you're using the ContentTemplate to customize the
CreateUserWizard control and also want to utilize the existing localizaed
resources of the CreateuserWizard control. However, when you try using the
<%$ Resources:... %> expression to reference the resource, it not work,

As for this issue, it is due to the natural limitation of the <%$ Resource
%> expression, this expression just identical to the following methods in

HttpContext.GetGlobalResourceObject Method

HttpContext.GetLocalResourceObject Method

Both of the two methods(also the <%$ Resource expression %>) can only
reference resource items defined within the current ASP.NET application's
LocalResource or GlobalResource, but can not reference resource items in
external assemblies. Actually, through the reflector diassembled code, you
can find that the built-in CreateUserWizard control is using the following
code to load resource string from assembly:

ResourceManager rm = new ResourceManager("System.Web",

rm.GetString(keyname, Culture);


Therefore, if you want to load any localization resource objects from
external assembly, you need to use ResourceManager to do it

Please feel free to let me know if you have anything unclear or any other
questions here.


Steven Cheng

Microsoft MSDN Online Support Lead


Get notification to my posts through email? Please refer to

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


This posting is provided "AS IS" with no warranties, and confers no rights.

Reply With Quote
Posts: n/a
Hello Steven,

thanks for the feedback!

> ResourceManager rm = new ResourceManager("System.Web",
> typeof(CreateUserWizard));

using typeof(CreateUserWizard).Assembly (with ".Assembly") instead, will
make it comilable.

The solution you have provided works great. Thanks a lot!

Best regards,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
py2app question: Resources/Python -> Resources/lib/python2.4 Russell E. Owen Python 0 09-08-2006 08:08 PM
Let ASPNET use mapped network drive... howto? Kruq ASP .Net 0 02-25-2005 09:45 AM
HowTo use CompareMethod.Text in String.IndexOf ? Andreas Klemt ASP .Net 0 03-06-2004 03:37 AM
howto make app1 sessions not expire while app2 is being use... Antonio Lopez Arredondo ASP .Net 1 12-03-2003 08:42 PM
Re: howto use c# regular expression validator to exclude file types Brian Vallelunga ASP .Net 2 07-31-2003 10:27 PM