title: How To Override The Same Function On Multiple ASP.NET Pages (Render Function)
body: <p>Take the following scenario. I have multiple ASPX pages. Login, Logout, Main, Messages, etc... They all inherit from System.Web.UI.Page of course.  For all the pages, I want to override the Render method from the Page class.  I could easily copy and paste the same code into each page like so:</p>
  
  <pre><code>protected override void Render(HtmlTextWriter writer)
  {
       //Code Logic Here
  }
  </code></pre>
  
  <p>But if I had many pages, lets say 20, maintaining the code in each page could get very time consuming and error prone.</p>
  
  <p>That made me think a bit and I thought okay lets try this...override the function in each page but call a static function. That way changing the static function would result in a change for every page.  Which works fine... But its not really nice and clean, having to override like that on every single page.  Anybody have any ideas or thoughts on this one?  Perhaps something simple I am overlooking?  Thanks</p>
  
  <p>EDIT: Some pages use the System.Web.UI.Page class and some pages inherit from another class called ModifiedPage which inherits and overridies other functions of the System.Web.UI.Page class. So its not as simple as inheriting all the pages from one class.</p>
  
  <p>EDIT2: All pages need this behavior, some already derive from another class, and I am unable to change the implementation or inheritance hierarchy of that other class.</p>