title: ASP.NET Server control error: Unknown server tag
body: <p>This is my first attempt to build an ASP.NET server control. Writing the control code was simple but I've run into a roadblock trying to get the control on a web page. </p>
  
  <p>I built the control in one project and referenced it in another. In that second project I got the control into the Toolbox and dragged/dropped the control on the page. I can compile the web project without error, but when I browse to the page I get this error:</p>
  
  <blockquote>
    <p>Parser Error Message: Unknown server tag 'cc1:StandardControl1'.</p>
  </blockquote>
  
  <p>Doing some looking around I see others having this problem for various reasons, but none seem to apply to my situation. One solution was to add the assembly to the register tag, but that isn't an issue with my page:</p>
  
  <pre><code>&lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="another.aspx.vb" Inherits="Educate.another" %&gt;
  &lt;%@ Register Assembly="ServerControlSandbox" Namespace="ServerControlSandbox" TagPrefix="cc1" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
          &lt;cc1:StandardControl1 runat="server"&gt;
          &lt;/cc1:StandardControl1&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Another solution said to add it to the web.config, again with the assembly attribute. But with this in my web.config I still get the error:</p>
  
  <pre><code>&lt;controls&gt;
          &lt;add tagPrefix="cc1" namespace="ServerControlSandbox" assembly="ServerControlSandbox"/&gt;
                  &lt;add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
                  &lt;add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
              &lt;/controls&gt;
  </code></pre>
  
  <p>I'm thinking there is something simple I am missing but I see nothing wrong, judging by the examples I've looked at. Does anyone have any ideas? Thanks.</p>
  
  <p>Also, here is the control code:</p>
  
  <pre><code>namespace ServerControlSandbox
  {
      [DefaultProperty("Text")]
      [ToolboxData("&lt;{0}:StandardControl1 runat=server&gt;&lt;/{0}:StandardControl1&gt;")]
      public class StandardControl : WebControl
      {
          [Bindable(true)]
          [Category("Appearance")]
          [DefaultValue("")]
          [Localizable(true)]
          public string Text
          {
              get
              {
                  String s = (String)ViewState["Text"];
                  return ((s == null) ? "[" + this.ID + "]" : s);
              }
  
              set
              {
                  ViewState["Text"] = value;
              }
          }
  
          protected override void RenderContents(HtmlTextWriter output)
          {
              output.Write(Text);
  
              string block = "&lt;p&gt;Here is some text.&lt;/p&gt;";
              output.Write(block);            
          }
      }
  }
  </code></pre>