Adventure Works Gear
![]() |
This example shows how to insert a custom header and footer within an ASP.NET page.
Both the header and footer in this page are stored as separate files with an .ascx filename extension, which can be easily inserted into any or all .aspx pages of a site via a simple <tagPrefix:tagName runat="server"
> declaration.
User controls are best suited in scenarios where code is to be shared and re-used across multiple pages of an application. These include not only static code for headers, footers, and menus, but even code that dynamically generates content as well.
To see how this sample is done, view the source code for this set of pages.