We are have a webapplication and have deployed a feature stapler that assigns the master page to each newly created site (reference).

I want to know a way in which we can hardcode the image path into the masterpage so that the image (site logo) gets applied to all sites along with the masterpage.

2 Answers 2


Put a SiteLogoImage control in your master page and hardcode its LogoImageUrl property.

The hardcoded logo can be overridden on an individual site by going to Site Settings > Title, Description, and Icon.

<SharePoint:SiteLogoImage ID="logoImage" runat="server" LogoImageUrl="/_layouts/images/siteIcon.png" />

Got the solution:

Along with default master and custom master we can set the site logo as well.

web.MasterUrl = webAppRelativePath + "_catalogs/masterpage/testmaster.master";
web.CustomMasterUrl = webAppRelativePath + "_catalogs/masterpage/testmaster.master";
web.SiteLogoUrl = webAppRelativePath + "Style%20Library/HD_Internal_Images/testmaster.png";
  • 1
    Much better than hardcoding it :) Commented Mar 28, 2014 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.