Zeeshan Hirani

Senior .net Developer
CheaperThanDirt.com

Registering Server Controls in web.config

If you have a custom server control that you are going to use in several different pages. It might be worth while to register the server control in web.config file instead of registering it in several different pages. Here is an example of registering my custom controls library in web.config file.

image

once you have registered the server control, you can declare this server in any aspx or ascx page as follows

image

Comments

Jain said:

Can User controls also  be defined in web.config

# May 16, 2008 11:41 PM

Stoian Bucovich said:

Thanks it was realy helpful.

# May 17, 2008 3:07 AM

HosamKamel said:

it will works only with website , and will not do for Web Application project

# May 17, 2008 8:11 AM

Cristovao Morgado said:

HosamKamel  ... is work in WAP also!

<pages >

     <controls>

       <add assembly="MillenniumCore.WebControls" namespace="MillenniumCore.WebControls" tagPrefix="MillenniumCoreWebControls"/>

</controls></pages>      

# May 17, 2008 10:31 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)