Click here to Skip to main content
12,997,531 members (59,670 online)
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 3 Feb 2009

How To: Create a Footer for your SharePoint Pages

, 15 May 2012
Rate this:
Please Sign up or sign in to vote.
This tip shows how to create a footer for your SharePoint pages.


If you want to use your SharePoint like a CMS, you probably would like to have a text at the bottom of your pages stating when it was last modified and by whom.


The topic and code of this article were first presented here.

It was modified with the addition of multi-language support (using out-of-the-box resources from SharePoint) and some SharePoint styling here.

This code goes a step further and enables support of local time zones as the controls presented by the postings above only present time in GMT.

This is done by using the UTCToLacalTime method of the SPTimeZone class, that can be accessed through the RegionalSettings property of the current site.

The addition of multilingual labels has been dropped in this user control, but can be added using the technique presented in the posting in the second link above.

Using the Code

In order to use the code, you need to place the user control in your 12 hive at this location: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12.

The code for your user control:

<%@ Control Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.Administration" %>
<script runat="server">
    string stLastModifiedDate = string.Empty;
    string stLastModifiedBy = string.Empty;
    string stLastModifiedByMemberID = string.Empty;    
    string stTxt = string.Empty;
    public string FileName()
        return System.Web.HttpContext.Current.Request.Url.AbsolutePath; 
    void Page_Load(object sender, EventArgs e)
        string stPageName = FileName();
        using (SPSite site = new SPSite(Page.Request.Url.ToString()))
            using (SPWeb web= site.OpenWeb())
                string stPath = site.MakeFullUrl(stPageName);
                SPFile File = web.GetFile(stPath);
                DateTime dateLastModifiedDate = File.TimeLastModified;
                stLastModifiedDate = 
                SPUser ModifierUser = File.ModifiedBy;
                stLastModifiedBy = ModifierUser.Name.ToString();
                stLastModifiedByMemberID = ModifierUser.ID.ToString();
                stTxt = "Last modified by:<a onclick=\"GoToLink(this);" + 
                  "return false;\" href=\"../_layouts/userdisp." + 
                 "aspx?ID=" + stLastModifiedByMemberID + 
                 "\">" + stLastModifiedBy + 
                 "</a>  " + stLastModifiedDate;
<table class="pageFooter">
            <%= stTxt %>

The CSS: I have added the pageFooter CSS class in the pageContent.css stylesheet:

{   font-family:Arial;
    line-height: 12px;


.pageFooter A:link

Finally, you place your control on your page layouts like this:

Register your Control

<%@ Register TagPrefix="Flygare" 

    TagName="PageFooter" src="~/_controltemplates/PageFooter.ascx" %>

Insert your Control

<Flygare:PageFooter id="PageFoot" runat="server" enableviewstate="true">


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jakob Flygare
Web Developer
Denmark Denmark
No Biography provided

You may also be interested in...


Comments and Discussions

Suggestionto insert a footer in master page Pin
vanita khatnani1-Apr-13 19:29
membervanita khatnani1-Apr-13 19:29 
GeneralGood Share Pin
jasonp127-Jan-10 9:12
memberjasonp127-Jan-10 9:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170622.1 | Last Updated 15 May 2012
Article Copyright 2009 by Jakob Flygare
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid