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?


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.


Use a FeatureReceiver that is triggered when a Feature is activated as described at http://salaudeen.blogspot.com/2011/03/sharepoint-feature-for-file-system.html

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.