Hi ,
You can use a user control(ascx) and place it on every page that needs this common logic. Furthermore if you have different case scenario you can set different property values in the different pages...
e.g
in page 1
<uc1:testuc id="TestUC 1" runat="server" data="1" xmlns:uc1="#unknown" />
in page 2
<uc1:testuc id="TestUC 1" runat="server" data="2" xmlns:uc1="#unknown" />
Regards,
T