views:

143

answers:

1

Hi,

I need to get main site url from inside my custom webpart. Is there any programming way to do it?

+2  A: 

Try :

        SPWeb currentWeb = SPContext.Current.Web;
        SPWeb rootWeb = currentWeb.Site.RootWeb;
tinky05