views:

2044

answers:

2

Hi,

I've registered a control in my web.config file and the .dll for the control has been placed in the application's Bin folder.

 <compilation debug="true">
  <assemblies>
   <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   <add assembly="RichTextEditor"/>
  </assemblies>

 </compilation>
 <pages>
  <controls>
   <add assembly="RichTextEditor" namespace="RichTextEditor" tagPrefix="cc1" />
  </controls>
 </pages>

I can now use this control in .aspx pages in the application root folder without issue. However, some of the .aspx pages I want to use this control in are stored in a sub-folder of the application (In this case a sub-folder called "Admin"). When I try to use these controls in these pages and run in debug I get an error of:

Error   1 Unknown server tag 'cc1:RichTextEditor'. N:\IntranetV2\admin\EditMenuItem.aspx 27

I'm sure I'm missing something simple here but I can't seem to figure out how to get this working and googling doesn't seem to have helped much.

UPDATE:

Okay I've tried Aaron's solution with no luck, I amended his code suggestion to:

<add tagPrefix="cc1" tagName="RichTextEditor" src="~/Bin/RichTextEditor.dll" />

I hoped this would be all that's required however I now get the error:

Error   1 There is no build provider registered for the extension '.dll'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

Please can someone help! I know the answer to this must be ridiculously simple but I'm going mad trying to fix it myself and google has proved no help.

A: 

Is the folder defined as an application in IIS? That would cause such a problem since in that case IIS will look for web.config (as well as bin/ and other special files and folders) inside that subfolder.

configurator
The sub folder is not defined as an application only the root. The sub folder is simply to separate out aspx pages for two different "areas" of the site so they're easier to keep track of (I hate cramped root folders!)
Jay Wilde
Ok, that is correct usage of the subfolder. I don't know what caused your problem then, sorry.
configurator
A: 

I had some similar problems a while back. Only way I was able to get the control working was something like this:

<add tagPrefix="cc1" tagName="RichTextEditor" src="~/controls/richtexteditor.ascx">

rather than this:

<add assembly="RichTextEditor" namespace="RichTextEditor" tagPrefix="cc1" />

EDIT:

Since you're using a binary, add the .dll to your solution, and add a reference to it in the project where you're using it. This way, .NET will add the .dll to your bin folder. Then, go back to this (and verify that the namespace and assembly are correct):

<add assembly="RichTextEditor" namespace="RichTextEditor" tagPrefix="cc1" />

Also, check this out as a reference: Tip/Trick: How to Register User Controls and Custom Controls in Web.config

Aaron
Tried this but no joy. I'm sure it's the solution if my control was an .ascx user control but it's not it's a compiled control saved in the bin file as a .dll.
Jay Wilde
Is this a third-party control? Have you checked their documentation? Since you're dealing with a binary, my guess is that you have either the namespace or assembly wrong (or both).
Aaron
It is a third party control yes. I wouldn't worry though I've given up and moved all the aspx files to the root folder. It's not what I want to do but I've spent way too much time on this already and my boss is chasing me for results. Thanks anyway.
Jay Wilde