Export (0) Print
Expand All
Expand Minimize

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(HttpContext) 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.

Show:
© 2014 Microsoft