Diference between SPSite and SPWeb

SPSite
SPWeb
It is a Site Collection including top level site.
It is a specific website under Site Collection. It could be individual sub site or top level site.
SPSite is container that contains a single SPWeb (ex: SPSite.RootWeb), Top level site is referred as root web.

To return the current site collection use :
SPSite site = SPContext.Current.Site
To return the web site:
SPWeb web = SPContext.Current.Web
Few methods are  Dispose(), Close(), Delete(), GetChanges(), GetUrls() etc.
Few methods are Delete(),Dispose(), GetList(), GetListFromUrl() etc.

Comments

Popular posts from this blog

what is Event Cache table in sharepoint

CAML Query syntax and options in SharePoint

Change anchor link url in sharepoint calender