tags:

views:

16

answers:

1

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?

A: 

You need FeatureReceiver and SPFile.MoveTo method.

Please, use this great tutorial on changing the default.aspx:

http://attis.org/blogs/dan/archive/2008/10/29/how-to-change-the-default-page-of-a-sharepoint-site-using-a-feature.aspx

omlin
This is a very good article however there are limitations (doesn't work) if you are executing a feature upon site creation process. Due to the sequence of operations i.e. features before final modules order the default.aspx doesn't exist when the moveto operation occurs and so there are issues you have to be aware of. I have yet to find a way to determine the original default.aspx associated with a site definition.
David
For some features you need site to be already created. It is normal practice. For example, in our installer, we are creating a new site collection first, and then deploying our features. So I think you simply need improve sequence of your deployment process. Another variant, if you are developing a sharepoint site definition. In this case, you need to include the default.aspx in your custom site definition. I can provide you the code if you need.
omlin