如何在webpart中获取主站点URL?

时间:2010-02-05 17:34:19

标签: sharepoint wss wss-3.0

我需要从我的自定义webpart中获取主站点URL。有没有编程方法可以做到这一点?

1 个答案:

答案 0 :(得分:3)

尝试:

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