What is the difference between these two methods of accessing the SharePoint model?
Asked Answered
T

1

4

Out of the several ways of accessing the SharePoint model of a SharePoint Services 3.0 site from an ASP.NET application, two seem to be very similar:

  1. SPWeb site = SPControl.GetContextWeb(Context);

  2. SPWeb site = SPContext.Current.Web;

It is my understanding that both of these methods need to be executed from within an ASP.NET application, so what is the difference between them and is there a situation where it is preferable to use one over the other?

Tade answered 20/11, 2008 at 18:2 Comment(0)
K
4

They technically save the same purpose but I recommend you use SPContext, which was introduced in the object model of WSS V3.0. The SPControl class is just there for backwards compatibility with WSS V2.0

Krona answered 20/11, 2008 at 21:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.