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

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 ?


share|improve this question
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";


share|improve this answer
Still Getting exception.. – Hitesh Chandegara Feb 23 '13 at 7:35

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.