I am going to exclude the fact that you are developing a web part for 2007. Web Parts mean that you want to give users the ability to add details to the pages of their choice. To implement the web part, you will need a separate DLL, which is either deployed in the bin directory of a SharePoint IIS application or the global build cache.
Typically, with SharePoint you do not have an ASPX page to insert controls inside and make it reproducible. ASPX pages will be created by users or features, and users will then add web parts to these pages. SharePoint is actually a virtual file system, and many of the ASPX pages either live in the database or in the SharePoint root folder, creating code for a non-trivial task.
The web part must be deployed as a separate DLL file. Given the way web parts are designed, you donβt have a design surface for creating a user interface, so you need to create your control tree using code, and the CreateChildControls section is the preferred time in the life cycle (see the previous link).
There are other ways, such as Son of SmartPart ( http://weblogs.asp.net/jan/archive/2005/11/22/431151.aspx ), which allows you to create a user control and then you load the user control into web part management tree. This is essentially the Microsoft approach adopted in 2010 with their Visual Web Part functionality.
The vast majority of web part development for SharePoint uses the same namespace as for ASP.NET, so if you are not performing certain SharePoint functions in your code, such as reading a list, etc., web parts should be used in ASP.NET and SharePoint.
John
source share