共用方式為


SafeControl element

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Represents an ASPX control or Web Part that is designated as secure for any user to access on any ASPX page on the SharePoint site.

Syntax

<SafeControl Assembly = "Name of assembly that contains the safe control"
    IsSafe = "true/false"
    IsSafeAgainstScript = "true/false"
    Name = "Name of this safe control entry"
    Namespace = "Namespace of the safe control"
    TypeName = "Type of the safe control" />

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
Assembly Optional xs:string attribute.

The name of the assembly in which the ASPX control or Web Part is defined. By default, this attribute uses the $SharePoint.Project.AssemblyFullName$ replaceable parameter for the assembly name. For more information, see Replaceable parameters.
IsSafe Optional xs:boolean attribute.

Specifies whether the ASPX control or Web Part is secure for untrusted users to access.
IsSafeAgainstScript Optional xs:boolean attribute.

Specifies whether untrusted users can view or edit the properties of the ASPX control or Web Part.
Name Optional xs:string attribute.

The name of this safe control entry in the collection.
Namespace Optional xs:string attribute.

The namespace of the ASPX control or Web Part.
TypeName Optional xs:string attribute.

The type name of the ASPX control or Web Part.

Child elements

None.

Parent elements

Element Description
SafeControls Represents a collection of ASPX controls and Web Parts that are designated as secure for any user to access on any ASPX page on the SharePoint site.

Remarks

For more information about safe controls, see Provide packaging and deployment information in project items.

Element information

Property Value
Namespace http://schemas.microsoft.com/VisualStudio/
2010/SharePointTools/SharePointProjectItemModel
Schema name SharePoint Project Item Schema
Validation file ProjectItemModelSchema.xsd
Can be empty No

See also