Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

2 Answers 2

up vote 1 down vote accepted

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

share|improve this answer

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

Your Answer

 
discard

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.