views:

179

answers:

1

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?

+2  A: 

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

Lars Fastrup