Register Dlls Assembly Custom User Controls Ascx In ASP.NET

This post explains how to Register Assembly, Custom Controls, Dlls And User Control Ascx In Asp.Net 2.0,3.5,4.0. To register these we need to add reference in page directive of aspx html source

<%@ Register TagPrefix="MyControl" TagName="HeaderControl"
Src="Header.ascx" %>
<%@ Register TagPrefix="MyControl" TagName="footerControl"
Src="Footer.ascx" %>
<%@ Register TagPrefix="MyAssembly" Assembly="Myassembly" %>

Or like this

<%@ Register Assembly="AjaxControlToolkit"
             TagPrefix="ajaxToolkit" %>

But using this we need to register our ascx control or dll in every page we want to use , if we need to use control or dll in more than one page or in several pages than we can register controls and dlls in web.config file

          <add tagPrefix="MyControl" src="~/Header.ascx" 
          <add tagPrefix="ControlName" src="~/Footer.ascx" 
          <add tagPrefix="MyAssembly" assembly="MyAssembly"/>
          <add tagPrefix="asp" namespace="System.Web.UI" 
               Version=, Culture=neutral,

If you like this post than join us or share


Anonymous said...

Thanks for sharing

sikat ang pinoy said...

building is very easy using ascx file that contain html and server control

Anonymous said...

Visual Studio 2008.. ASP.NET 3.5


Gets this error.

Invalid or missing attributes found in the tagPrefix entry. For user control, you must also specify 'tagName' and 'src'. For custom control, you must also specify 'namespace', and optionally 'assembly'.

Find More Articles