Provides methods for getting or setting the context of the request and serves as the base server control from which other controls in the
Microsoft.SharePoint.WebControls namespace derive.
Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Visual Basic (Declaration)
<DesignerAttribute(GetType(SPControlDesigner))> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class SPControl
Inherits Control
Implements IDesignTimeHtmlProvider, IDesignerEventAccessor
Dim instance As SPControl
[DesignerAttribute(typeof(SPControlDesigner))]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class SPControl : Control, IDesignTimeHtmlProvider, IDesignerEventAccessor
The following code example returns both a site collection object and a site object.
[Visual Basic .NET]
Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim site As SPWeb = SPControl.GetContextWeb(Context)
[C#]
SPSite siteCollection = SPControl.GetContextSite(Context);
SPWeb site = SPControl.GetContextWeb(Context);
System.Object
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Derived Classes
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.