views:

144

answers:

2

Can someone please let me know the pros and cons of registering user controls in web.config vs. on top of asp pages?

I am looking for performance issues in particular. Does having all the controls registered in web.config make the pages slower to load (even the pages that do not use these controls)?

A: 

Not a heck of a lot cons to putting it into the web.config. It just can't be done with a drag and drop, so many just don't do it. Keeps the page less cluttered and makes change easier in the long term.

Rob
+2  A: 

Web.config Pros

  1. Only 1 place to add extra bit of code

Web.config Cons

  1. Sometimes, I forget to update web.config on production environment since I never copy the web.config from staging area to live site.

On every page pros

  1. When you deploy/publish pages and/or copy pages from dev/test/staging to live server, you don't need to worry about updating web.config

One very page cons

  1. Its on every page, so if something changes, it's a pain to go through every page and fix it
  2. You have to add it manually to each page

I'd recommend doing it in the web.config. It's less work for you since you don't need to remember to add it to every page. Although, if you have a ton and lots are only used on a single page, then you could do a bit of both to keep your web.config a bit less cluttered. I usually put my controls in web.config, if I use them in more than one page. If it's just used on a single page, then I usually just declare it in my asp.net page.

Jim W