Reference a current sharepoint web or subsite by context.

SPWeb web = SPContext.Current.Web;
or
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();

No comments: