Close Method

The Close method of the SPWeb class closes the Web site at the end of a request and releases resources.

Remarks

Calling the Close method has the same effect as calling the Dispose method. Use the Close method to close the SPWeb object and release resources when you are finished using the object. Do not reuse the object or objects obtained through the object after it is closed.

Warning  Do not use this method to close a shared resource, such as when the Web site object is provided by the GetContextWeb method in a Web Part. Instead let Windows SharePoint Services or your portal application manage the object. Using this method on a shared resource causes an access violation error to occur.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security