I am developing an event receiver, using the ItemUpdating event, and I noticed that the properties parameter has an "OpenWeb" method, with this description:

Retrieves the Web site that is associated with the event that occurred.

while it also has a "Web" property, with this description:

Gets the parent Web site of the list associated with the event that occurred.

what is the difference?

2 Answers 2


The only difference is that properties.Web is cached for the duration of the event (after the first access to it).

So properties.Web is implemented to check if it has a cached SPWeb if so return that if not call properties.OpenWeb() and cache the result.

Neither of them will cause a memory leak as they are created from an SPSite which is disposed at the end of the event

  • so.. i should always use Web, to avoid getting an SPWeb that's already cached? what's the point of having OpenWeb be public then?
    – Nacht
    Commented May 29, 2012 at 22:53
  • 2
    OpenWeb is mainly for backwards compability. Web didn't exist in WSS 3.0 Commented May 30, 2012 at 6:53
  • Why is OpenWeb not deprecated then?
    – Nacht
    Commented Mar 20, 2013 at 22:28
  • SharePoint don't generally deprecate things just because there now is a better option Commented Mar 21, 2013 at 7:20

Please check this post https://stackoverflow.com/questions/8786383/what-the-difference-between-spcontext-current-web-site-openweb-listslist

On the same line check http://msdn.microsoft.com/en-us/library/ee724407.aspx

So using SPWeb web = properties.OpenWeb(); is much more efficient.

  • i don't see that conclusion at all! the first link says don't use OpenWeb, as it will leak memory, and the second link says nearly the same thing. Also, neither of those show a time where both OpenWeb() and Web are available from the same object.
    – Nacht
    Commented May 29, 2012 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.