What is the difference between the two methods for accessing the SharePoint model?

Of the several ways to access the SharePoint Services 3.0 site SharePoint model from an ASP.NET application, two seem very similar:

  • SPWeb site = SPControl.GetContextWeb(Context);

  • SPWeb site = SPContext.Current.Web;

As far as I understand, both of these methods should be executed from an ASP.NET application, so what is the difference between them and is there a situation when it is preferable to use one of them?

+4
source share
1 answer

They technically keep the same goal, but I recommend using SPContext, which was introduced in the WSS V3.0 object model. The SPControl class exists only for backward compatibility with WSS V2.0

+4
source

All Articles