You can do one thing. Add a base class in which add this code. Inherit every page from that
Base Class.
For example, your code behind class is like inheriting
System.Web.UI.Page
...
public partial class someClassName : System.Web.UI.Page
{
}
Instead of the above, you will write...
public partial class someClassName : BaseClass
{
}