Difference Between SPSite & SPWeb………….
- SPSite Represents a collection of sites on a virtual server, including a top-level site and all its subsites.
- Each SPSite object, or site collection, is represented within anSPSiteCollection object that consists of the collection of all site collections on the virtual server.
- SPSite.OpenWeb Method: Returns the site that is located
at the specified server-relative or site-relative URL.
SPWeb class :
SPWeb Simply represents Windows SharePoint Services Web site.
Code sample to create a site:
SPSite mySite = new SPSite(“http://servername/”);
SPWeb myWeb = mySite.AllWebs[“Site_Name”];
SPWeb myRootWeb = mySite.RootWeb;
- SPSite and SPWeb inherit directly from System.Object
- Calling Dispose ensures all resources used by those objects are immediately released.
SHARE THE KNOWLEDGE