RsaProtectedConfigurationProvider.ExportKey(String, Boolean) Method


Exports an RSA key from the key container.

 void ExportKey(System::String ^ xmlFileName, bool includePrivateParameters);
public void ExportKey (string xmlFileName, bool includePrivateParameters);
member this.ExportKey : string * bool -> unit
Public Sub ExportKey (xmlFileName As String, includePrivateParameters As Boolean)



The file name and path to export the key to.


true to indicate that private parameters are exported; otherwise, false.


path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.

path is null.

The specified path, file name, or both exceed the system-defined maximum length.

The specified path is invalid, such as being on an unmapped drive.

An error occurred while opening the file.

path specified a file that is read-only.


This operation is not supported on the current platform.


path specified a directory.


The caller does not have the required permission.

The file specified in path was not found.

path is in an invalid format.

The caller does not have the required permission.

Applies to

See also