代码
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb web = SPControl.GetContextWeb(Context);
using (SPWeb wb = new SPSite(web.Site.ID).OpenWeb(web.ID))
{
//获取当前站点下的所有子站点
SPWebCollection subwebcol = wb.Webs;
for (int i = 0; i < subwebcol.Count; i++)
{
//子站点的url
string strurl= subwebcol[i].Url ;
//子站点的name
string strname=subwebcol.Names[i] ;
}
}
});