    using System;
    using System.Collections;
    using System.Web.Security;
    using ASPNET.StarterKit.TimeTracker.BusinessLogicLayer;

    namespace ASPNET.StarterKit.TimeTracker.Web
    {
        // UserControl that contains the top logo as well as the main navigation tabs
        public abstract class Banner : System.Web.UI.UserControl
        {
            protected System.Web.UI.WebControls.LinkButton LogOff;
            protected System.Web.UI.WebControls.DataList tabs;

            private void Page_Load(object sender, System.EventArgs e)
            {
                ArrayList tabItems = new ArrayList();

                if (Request.IsAuthenticated)
                    // add the Log tab (all users can see this tab)
                    tabItems.Add(new TabItem("Log", "TimeEntry.aspx?index=" + tabItems.Count));

                // Show log off button if user is form authenticated
                if (Context.User.Identity.AuthenticationType == "Forms")
                    LogOff.Visible = true;

                if (TTSecurity.IsInRole(TTUser.UserRoleAdminPMgr))
                {
                    tabItems.Add(new TabItem("Reports", "Reports.aspx?index=" + tabItems.Count));
                    tabItems.Add(new TabItem("Administration", "ProjectList.aspx?index=" + tabItems.Count));
                }

                tabs.DataSource = tabItems;
                tabs.SelectedIndex = (Request["index"]==null) ? 0 : Convert.ToInt32(Request["index"]);
                tabs.DataBind();
            }

            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                //
                // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                //
                InitializeComponent();
                base.OnInit(e);
            }

            ///        Required method for Designer support - do not modify
            ///        the contents of this method with the code editor.
            ///
            private void InitializeComponent()
            {
                this.LogOff.Click += new System.EventHandler(this.LogOff_Click);
                this.Load += new System.EventHandler(this.Page_Load);

            }
            #endregion

            private void LogOff_Click(object sender, System.EventArgs e)
            {
                FormsAuthentication.SignOut();

                // Invalidate roles token
                Response.Cookies["userroles"].Value = "";
                Response.Cookies["userroles"].Path = "/";
                Response.Cookies["userroles"].Expires = new System.DateTime(1999, 10, 12);

                Context.User = null;
                Response.Redirect("Default.aspx", false);
            }
        }
    }