SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a custom application page "custom.aspx" on the Layout folder, would like to rename the original file "custom.aspx" to "custom_bak.aspx" before the updated/modified custom application page "custom.aspx" is placed on the same location while activating a custom feature.

any clue? how would I achieve it?

share|improve this question

If you are providing "custom.aspx" through your custom solution/feature the most logical place for doing backup of that file is by using SPFeatureReceiver.FeatureDeactivating method. So when you deactivate your feature backup is created and when you again activate it the new file will be provisioned.

If you are using modules or if you are providing application pages your file is most likely already deployed once SPFeatureReceiver.FeatureActivated fires so this is not good place to put backup code. Only scenario where this can be done is if you are doing all your file provisioning in code.

share|improve this answer
up vote 1 down vote accepted

Use a FeatureReceiver that is triggered when a Feature is activated as described at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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