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

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";
                    objFolder.Update();
                    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 ?

Thanks

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

1 Answer 1

Instead of using,

objFolder.WelcomePage = "default.aspx";

try,

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

Source

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

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.