views:

38

answers:

1

I have defined the following control which serves as a wrapper for another control (simplified code):

using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Company.Dept.Project.Controls.ControlName
{
    [
        AspNetHostingPermission(SecurityAction.Demand,
            Level = AspNetHostingPermissionLevel.Minimal),
        AspNetHostingPermission(SecurityAction.InheritanceDemand,
            Level = AspNetHostingPermissionLevel.Minimal),
        DefaultProperty("Text"),
        ValidationProperty("Text"),
        ToolboxData("<{0}:ControlName runat=\"server\"> </{0}:ControlName>")
    ]
    public class ControlName : WebControl, INamingContainer
    {
        private TextBox _myTextBox;

        public string Text
        {
            get
            {
                EnsureChildControls();
                return _myTextBox.Text;
            }
        }
        protected override void CreateChildControls()
        {
            _myTextBox = new TextBox { ID = "MyTextBox" };
            Controls.Add(_myTextBox);
        }
    }
}

Which is used in a user control:

<%@ Register Assembly="Company.Dept.Project.Controls" Namespace="Company.Dept.Project.Controls TagPrefix="MyControls" %>
<MyControls:ControlName ID="ControlName1" runat="server" />

When run locally from the ASP.NET Development Server, DIT Server and SIT Server, the control renders and operates as expected. However, on the UAT Server, I receive the following error:

System.Web.HttpException: 'Company.Dept.Project.Controls.MyControls' is not allowed here because it does not extend class 'System.Web.UI.UserControl'

Can anyone provide any insight as to why it is failing in one environment, but not the others? Is this something related to configuration? The user control is hosted within a "SmartPart" style user control loader which is being used on a WSS 3.0 site in the DIT/SIT/UAT environments.

Thanks!

A: 

It appears that this error can occur when a referenced assembly is missing.

The issue was resolved after rebuilding the installation packages and redeploying.

Dylan Berry