my code on feature activated is

public override void FeatureActivated(SPFeatureReceiverProperties properties)
        using (SPSite SiteInUserContext = new SPSite((properties.Feature.Parent as SPWeb).Url))
            using (SPWeb webInUserContext = SiteInUserContext.OpenWeb())
                    webInUserContext.AllowUnsafeUpdates = true;
                    SPFolder objFolder = webInUserContext.RootFolder;
                    objFolder.WelcomePage = "default.aspx";
                    webInUserContext.AllowUnsafeUpdates = false;

Exception details is:

enter image description here

Note : This exception occurs only when set default page on feature activated or feature deactivated.

How to resolve this exception ?


  • Error you are seeing is general error and can come because of different reasons – Muhammad Raja Feb 22 '13 at 14:47

Instead of using,

objFolder.WelcomePage = "default.aspx";


objFolder.WelcomePage = "Pages/default.aspx";


| improve this answer | |

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.