registering user controls in web.config, causes error if used in same directory...

T

Tim_Mac

Hi,
i have this in my web.config:
<pages validateRequest="false" >
<controls>
<add tagPrefix="uc1" src="/Whatever.ascx" tagName="Whatever"/>

i have this in Login.aspx:
<uc1:Whatever id="Blah" runat="server">

I get this error message:

Cannot use the user control '/Whatever.ascx', because it is registered in
web.config and lives in the same directory as the page.

this same message has been posted twice without answers on the forums at
www.asp.net
http://forums.asp.net/thread/1347796.aspx
http://forums.asp.net/thread/1253193.aspx

does anyone know what is going wrong?

i'm using a Web Application Project. the problem goes away when i move the
user control into a subdirectory and update the web.config reference etc.

thanks in advance
tim
 
W

Walter Wang [MSFT]

Hi Tim,

This limitation is documented in following MSDN library:

http://msdn2.microsoft.com/en-us/library/system.web.configuration.tagprefixi
nfo.aspx

This is due to internal design consideration (performance). The common use
of this new feature is to have a directory containing a bunch of user
controls, and register them in config so that they are available in all
pages. Thank you for your understanding.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
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.
 
R

Rhywun

The [controls] tag also doesn't work when used in a web.config file
that's in a subdirectory of the root directory, right?
 

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