WebPartManager.ExportWebPart Method (WebPart, XmlWriter)
Creates an XML description file that contains state and property data for a server control.
Assembly: System.Web (in System.Web.dll)
Themethod assembles various state and property data from webPart into an XML file. The data includes information about the control itself, including its assembly, state data, and property data. The user who initiates the export can save the XML file to disk on the local computer or the network. Other users can then import the description file to a different page or Web site, and apply the state and property data to a different instance of webPart. This provides a fast and convenient mechanism for users to share and reuse their settings on server controls, and it also provides developers with a means to control the appearance and behavior of exported and imported controls.
Properties on webPart are not exported by default. To enable export of a property, you must mark it with the [Personalizable] attribute in the source code. You can also optionally mark an exportable property as containing sensitive data, by setting the isSensitive parameter of the [Personalizable] attribute to true. By default, isSensitive is false. Developers can set the parameter to true to indicate that the data is sensitive.
To enable webPart to be exported, a developer sets its ExportMode property value to either All (which includes all personalizable and sensitive properties), or to NonSensitiveData, which exports everything except for sensitive properties.
Allowing users to export data from controls, and to import data into other controls, entails some security risks. Developers should use the approach discussed above to protect sensitive data, and if they want to avoid the risk of exposing data altogether, they should not enable export on webPart at all. For details on Web Parts security issues, see Securing Web Parts Pages.
Available since 2.0