tags:

views:

20

answers:

2

Is there a way from within a feature to locate the default.aspx which is delivered with a custom site definition. I have a scenario where I replace the default.aspx page with a custom page, but when the feature gets deactivated I need to put the original back in place.

I have considered moving the existing default.aspx to default-old.aspx when the initial replacement happens (activated) however the existing default.aspx doesn't exist yet (when feature executes during provisioning) and hence I do not have the ability to rename the existing.

Hence my question, how can I locate through code the default.aspx page associated with a site definition? thx

A: 

You can use SPWeb.Navigation.Home.Url

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.navigation.spnavigation.home.aspx

omlin
A: 

I would give your new/updated default page a different name, deploy and then change the welcome page of the site by code in a feature receivers feature activated event. If you are working with Moss 2007 you can use the PublishingWeb.DefaultPage property or for WSS this approach.

Bernd