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

I need to set the homepage to default.aspx in my FeatureActivated event receiver. I tried

rootWeb.RootFolder.WelcomePage = "default.aspx";
rootWeb.RootFolder.Update();

but that doesn't seem to be working...this HAS to work in Sharepoint Foundation....i have seen some methods that are not compatible with foundation?

TIA

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Please check this link to see how to set your home page.

If this does not work, please try to debug and check if your FeatureActivated event gets fired.

Hope this helps

Cheers!

My bad that I did not see that. Anyways can you please try below,

Please use this in feature activating,

using (SPWeb web = (properties.Feature.Parent as SPWeb)) {

            if (web != null)
            {
                SPFolder rootFolder = SPContext.Current.Web.RootFolder;
                rootFolder.WelcomePage = "YOURCUSTOMURLGOESHERE";
                rootFolder.Update();
            }
        }

If you would like to resort to your default page during feature deactivation,

rootFolder.WelcomePage = "default.aspx";

share|improve this answer
    
SharePoint Foundation doesn't include publishing features hence the link you posted doesn't apply as it uses SharePoint Server features. Just FYIO. –  Sig Weber Oct 18 '12 at 16:07
    
Yep...thats what i thought. There has to be a way to do this in Sharepoint Foundation short of replacing Home.aspx :P –  MikeC Oct 18 '12 at 17:59
    
I have edited my original post, to achieve this. –  Battlesmith Oct 19 '12 at 1:15
add comment

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.