Whenever we enter the URL in address bar of the browser for moss site, it automatically redirects to the Default.apsx. If we want user to go to some different page in the site.
so here is the code we write for that.
I am changing this in webpart so i am writing this code in webpart page. it is possible to have this code in Feature.
SPContext.Current.Web.AllowUnsafeUpdates = true;
SPFolder objFolder = SPContext.Current.Web.RootFolder;
objFolder.WelcomePage = "Shared%20Documents/Forms/AllItems.aspx";
objFolder.Update();
SPContext.Current.Web.AllowUnsafeUpdates = false;
Now when the user will hit the URL, it will automatically redirected to Shared Documents AllItems.aspx
That's it. you are done with this.
2 comments:
thanks for the code, but where does it go? Which webpart do I paste it into?
Cheers,
Adrienne
Hi Adrienne,
This is admin kind of stuff you can create a webpart for one time use. or you can create a feature and write this code in feature receiver.
Thanks.
Post a Comment