XsltSettings.TrustedXslt 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 XsltSettings 物件,此物件會啟用 XSLT document()
函式和內嵌指令碼區塊的支援。
public:
static property System::Xml::Xsl::XsltSettings ^ TrustedXslt { System::Xml::Xsl::XsltSettings ^ get(); };
public static System.Xml.Xsl.XsltSettings TrustedXslt { get; }
member this.TrustedXslt : System.Xml.Xsl.XsltSettings
Public Shared ReadOnly Property TrustedXslt As XsltSettings
屬性值
XsltSettings 和 EnableDocumentFunction 屬性設為 true
的 EnableScript 物件。
範例
下列範例會載入支援 XSLT document()
函式和內嵌腳本區塊功能的樣式表單。
// Create a resolver and specify the necessary credentials.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
System.Net.NetworkCredential myCred;
myCred = new System.Net.NetworkCredential(UserName,SecurelyStoredPassword,Domain);
resolver.Credentials = myCred;
// Create the XslCompiledTransform object and load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("http://serverName/data/script.xsl", XsltSettings.TrustedXslt, resolver);
' Create a resolver and specify the necessary credentials.
Dim resolver As New XmlSecureResolver(New XmlUrlResolver(), "http://serverName/data/")
Dim myCred As System.Net.NetworkCredential
myCred = New System.Net.NetworkCredential(UserName, SecurelyStoredPassword, Domain)
resolver.Credentials = myCred
' Create the XslCompiledTransform object and load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load("http://serverName/data/script.xsl", XsltSettings.TrustedXslt, resolver)
備註
重要
僅當需要指令碼支援且在完全受信任的環境中運作時,才應啟用 XSLT 指令碼。 如果啟用函 document()
式,您可以將 物件傳遞 XmlSecureResolver 至 Transform 方法,以限制可存取的資源。