Partilhar via


SPContext.Web Property

Gets the Web site that is associated with the current Microsoft SharePoint Foundation request context. Used in conjunction with the static Current property.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableAttribute(Name := "Web")> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.NotNull)> _
Public ReadOnly Property Web As SPWeb
    Get
'Usage
Dim instance As SPContext
Dim value As SPWeb

value = instance.Web
[ClientCallableAttribute(Name = "Web")]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.NotNull)]
public SPWeb Web { get; }

Property Value

Type: Microsoft.SharePoint.SPWeb
The Web site of the current request context.

Remarks

Use SPContext.Current.Web to get the Web site of the current request context.

See Also

Reference

SPContext Class

SPContext Members

Microsoft.SharePoint Namespace