Q:

.Net Access Global Variable In Server Include from Master Page

I want to have the Date as a global variable that a server included aspx can access. I have a handful of master templates, but I want the header and the footer to be a server include so that I just have one place to update links instead of having them in each of the masters. In the footer, I want the copyright date to be dynamic and hopefully make that a global variable that can be accessed elsewhere.
I tried putting it in the master page and also the server include in a server script in the aspx, but I haven't been able to get either working. I get that the error that the variable does not exist in the context. I tried declaring and registering the namespace, but I must be doing something wrong.
I want to get the variable currentYear from the Master Page Code into the footer.aspx (include).
Master Page
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="OneColumn.master.cs" Inherits="Project.Masters.OneColumn" %>
<!DOCTYPE html>
<html>
<head id="oneColumnHead" runat="server">
<title></title>
</head>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body>
<form id="oneColumnForm" runat="server">
<asp:ContentPlaceHolder ID="body" runat="server"></asp:ContentPlaceHolder>
</form>
    <%-- Shared Footer --%>
    <!-- #Include file="inc_footer.aspx" -->

</body>
</html>

Master Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Project.Masters
{
    public partial class OneColumn : System.Web.UI.MasterPage
    {

        static int currentYear = DateTime.Now.Year;

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

Footer Aspx
<div id="footer">Copyright © <%= currentYear %></div>

So the footer just contains the HTML to be included. How do I register that master page in the footer include?
EDIT: OK so it is not possible. I am trying the User Control method. That is not working either.
This is what I have.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Project.Masters
    {
    public partial class uc_footer : System.Web.UI.UserControl
        {
        static int currentYear = DateTime.Now.Year;
        string dateYear = currentYear.ToString();

        protected void Page_Load(object sender, EventArgs e)
            {

            }
        }
    }

The ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="uc_footer.ascx.cs" Inherits="TeamWork.Masters.uc_footer" %>
<div id="footer">Copyright © <%= dateYear %></div>

It still says it does not exist in context.

A:

You could do it something like this:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="OneColumn.master.cs"
  Inherits="Project.Masters.OneColumn" %>
<%@ Register TagPrefix="uc" TagName="footer" Src="~/PATHTOYOURCONTROL" %>
<!DOCTYPE html>
<html>
    <head id="oneColumnHead" runat="server">
    <title>Master page title</title>
    </head>
    <body>
    <form id="oneColumnForm" runat="server">
        <table>
           <tr>
                <td>
                    <asp:ContentPlaceHolder ID="head" runat="server">
                    </asp:ContentPlaceHolder>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:ContentPlaceHolder ID="body" runat="server">
                    </asp:ContentPlaceHolder>
                </td>
            </tr>
            <tr>
                <td>
                    <uc:footer id="footer1" runat="server"/>
                </td>
            <tr>
        </table>
    </form>
    </body>
</html>

You can read more here how to include a control to the page

