0

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

truthseeker
  • 2,214
  • 6
  • 30
  • 53

1 Answers1

3

Try :

        SPWeb currentWeb = SPContext.Current.Web;
        SPWeb rootWeb = currentWeb.Site.RootWeb;
tinky05
  • 250
  • 5
  • 13