Master pages should only be used for layouts, in my opinion.
If you want to do work such as creating connections, do it in the base class.
However, it is important that you do not create a database connection at the beginning of your page and do not close it at the end. You must open and close connections when performing separate requests. This allows you to work effectively with the connection pool.
In addition, I would not put a connection of any type on the page itself, since you want to separate your capabilities from the layout as much as possible.
source
share