SecurityManager.SavePolicy Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Note: This API is now obsolete.

Saves the modified security policy state.

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

[ObsoleteAttribute("This method is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPolicy)]
public static void SavePolicy()

Exception Condition
NotSupportedException

This method uses code access security (CAS) policy, which is obsolete in the .NET Framework 4. To enable CAS policy for compatibility with earlier versions of the .NET Framework, use the <legacyCasPolicy> element.

SecurityException

The code that calls this method does not have SecurityPermissionFlag.ControlPolicy.

This method saves the policy as exposed by PolicyHierarchy, PolicyLevel, and other classes that represent configuration of the security policy. Unless this method is called, changes made to the policy objects will not be saved and will not affect subsequent application runs.

SecurityPermission

for the ability to modify policy. Associated enumeration: SecurityPermissionFlag.ControlPolicy

.NET Framework
Available since 1.1
Return to top
Show: