aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


Posted by Aamir Hasan   on Thursday, March 31, 2011 Total Views:  


In this example, you will see that how can we register multiple web user control in Web.Config.  When you are working on multiple web user control and repeating them on different pages in your project.

Let’s start

Here, I will assume that you know how to create a web site/ web application project.

Open you Web Site, right click on your Web Site from Solution Explorer. Create new folder named CustomControl and add three web user controls with named WebUserControl1.ascx, WebUserControl2.ascx and WebUserControl3.ascx.

Your solution explorer will looks like


 Most of developer registers then on each page by adding <%@ Register %> directives to the top of pages.

 <%@ Register src="~/CustomControls/WebUserControl1.ascx" tagname="UserControl" tagprefix="UserControl1" %>

<%@ Register src="~/CustomControls/WebUserControl2.ascx" tagname="UserControl" tagprefix="UserControl2" %>

<%@ Register src="~/CustomControls/WebUserControl3.ascx" tagname="UserControl" tagprefix="UserControl3" %>


Let us register web user controls in the Web.Config file.


<?xml version="1.0"?>





        <add tagPrefix="UserControl" src="~/CustomControls/WebUserControl1.ascx" tagName="UserControl1" />

        <add tagPrefix="UserControl" src="~/CustomControls/WebUserControl2.ascx" tagName="UserControl2" />

        <add tagPrefix="UserControl" src="~/CustomControls/WebUserControl3.ascx" tagName="UserControl3" />






Now, Controls can be used in any page

            <UserControl:UserControl1 ID="UserControl1" runat="server" />

            <UserControl:UserControl2 ID="UserControl2" runat="server" />

If the intelligence is enabled in your visual studio, you will see


It is easy to use and manage, you don’t have to registered it on multiple page where you have to used web user control.


Note: If you have alternative solution, please comments here to share with us.



Register-WebUserControl-in-Web.Config.rar (129.14 kb)

Protected by Copyscape Online Plagiarism Tool

Comments (3) -

Vernie Namca
Vernie Namca Philippines
1/5/2013 4:11:23 AM #

Nice solution Aamir Hasan. Very helpful, keep up the good work.

Chinese Restaurant Equipment
Chinese Restaurant Equipment United States
10/16/2013 12:03:12 AM #

I am really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see a nice blog like this one nowadays.|

Samella Verni
Samella Verni United States
7/13/2015 8:03:37 AM #

Keep on writing, great job!|

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5