这两种访问 SharePoint 模型的方法有什么区别?
从 ASP.NET 应用程序访问 SharePoint Services 3.0 网站的 SharePoint 模型的多种方法中,有两种似乎非常相似:
SPWeb site = SPControl.GetContextWeb(Context);
SPWeb 站点 = SPContext.Current.Web;
据我了解,这两种方法都需要在 ASP.NET 应用程序中执行,那么它们之间有什么区别,是否存在使用其中一种方法更好的情况?
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:
SPWeb site =
SPControl.GetContextWeb(Context);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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们在技术上具有相同的目的,但我建议您使用 SPContext,它是在 WSS V3.0 的对象模型中引入的。 SPControl 类只是为了向后兼容 WSS V2.0
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