I have created a feature which deploys a custom default.aspx page. The deployed file goes to the template\features{featureName} directory.

How does SharePoint know to use this default.aspx page instead of the one that is located in SiteTemplates{Site Def name} directory?


Is that a Publishing site? if yes then you can write a module element to upload this default page on SharePoint Pages library and overwrite the preexisting one. You may need to write feature receiver to overwrite the existing file or you can refer my blog to overwrite files using SharePoint module element. http://vivek-soni.blogspot.com/2009/07/overwriting-files-using-module-element.html

  • This is a very good article no doubt. This issue however is that the feature is stapled to a site definition. In the sequence of operations the features run before the provisioning process has an opportunity to put the default.aspx page in place. As such, it is not possible to get a reference to the default.aspx which is delivered with the site definition. – dave Sep 16 '10 at 14:40
  • I can deploy a customDefault.aspx page but i cannot have it replace the default.aspx as it doesn't exist yet in the sequence of operations. I can however deploy a page called default.aspx. My issue is when I go to deactivate the page, how can I get a reference to the site definition original default.aspx? (as mentioned i cannot get a reference to it in my feature as it doesnt exist yet). thx – dave Sep 16 '10 at 15:40
  • In that case you can write a custom site provisioning handler that would run after your site hasbeen provisioned completely. Now this provisioning handler could either activate another feature that has a new default.aspx page or you could write the code to manually delete the default.aspx and upload a new one. – Vivek Sep 16 '10 at 16:01
  • Do you mean, an external application that provisions the site and once the site has been created(finished) activate another feature OR from within replace the default.aspx page? – dave Sep 16 '10 at 17:45
  • Yes refer this sharepointdev.net/sharepoint--development-programming/… on how we can use SPWebProvisioningProvider – Vivek Sep 16 '10 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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