Close method
Collapse the table of content
Expand the table of content

SPWeb.Close method

Closes the website at the end of a request and releases resources.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public void Close()

Uses this method to release the resources of the SPWeb object when you are finished using the object. Do not reuse the object or objects that are obtained through the object after it is closed.

If you create an SPWeb object, use this method to close the object. However, if you have a reference to a shared resource, such as when the object is provided by the GetContextWeb method, do not use this method to close the object, but instead allow SharePoint Foundation or your portal application to manage the object. For more information about good coding practices, see Disposing Objects.

© 2015 Microsoft