How to get main site url inside webpart?
I need to get main site开发者_开发问答 url from inside my custom webpart. Is there any programming way to do it?
Try :
SPWeb currentWeb = SPContext.Current.Web;
SPWeb rootWeb = currentWeb.Site.RootWeb;
精彩评论