SecurityElement.FromString Method (String)


Creates a security element from an XML-encoded string.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

public static SecurityElement FromString(
	string xml


Type: System.String

The XML-encoded string from which to create the security element.

Return Value

Type: System.Security.SecurityElement

A SecurityElement created from the XML.

Exception Condition

xml contains one or more single quotation mark characters.


xml is null.

Do not use single quotation marks in the XML string; instead, use escaped double quotation marks. For example, instead of "<value name='Company'>Microsoft</value>" use "<value name=\"Company\">Microsoft</value>".

Using single quotation marks can result in either an exception being thrown or, in some cases, the single quotation marks being treated as text in the string.

.NET Framework
Available since 2.0
Return to top