Gets or sets the text of a warning message that is displayed when a user attempts to export sensitive state data from a WebPart control.
Assembly: System.Web (in System.Web.dll)
When a user attempts to export sensitive state data from a WebPart control, if any of the data being exported comes from a member that was marked as sensitive in the source code, a warning message is displayed to the user in a message box, telling them that sensitive data is being exported and providing an opportunity to cancel the export. Developers can mark a specific member's data as sensitive by setting the isSensitive parameter of the [Personalizable] attribute to true on the member. For more information about this attribute and parameter, see the PersonalizableAttribute class.
When you use the export feature of Web Parts, sensitive data could potentially be exported to unauthorized users. For details on how to protect against this threat, see Securing Web Parts Pages.
The default message is displayed whenever users attempt to export. However, by assigning a value to theproperty, you can provide a custom warning message.
The following code example demonstrates the declarative use of theproperty.
The code for the following Web page uses a standard BulletedList control and places it in a zone. The control will be wrapped with a GenericWebPart control at run time, which enables it to act as a true WebPart control. To make the control exportable, an ExportMode attribute is added to the <asp:bulletedlist> element, and the attribute value is set to All, which means that both sensitive and non-sensitive data can be exported. Note also that in the <asp:webpartmanager> element, the ExportSensitiveDataWarning attribute is assigned a custom value.
Note that for the code example to work, there is a setting you must add in the Web.config file to enable exporting Web Parts description files. Ensure that you have a Web.config file in the same directory as the Web page for this code example. Within the <system.web> section, make sure there is a <webParts> element with an enableExport attribute set to true, as in the following markup.
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <div> <asp:WebPartManager ID="WebPartManager1" runat="server" ExportSensitiveDataWarning="Sensitive data is being exported"/> <asp:WebPartZone ID="WebPartZone1" runat="server"> <ZoneTemplate> <asp:BulletedList DisplayMode="HyperLink" ID="BulletedList1" runat="server" Title="My Links" ExportMode="All"> <asp:ListItem Value="http://www.microsoft.com"> Microsoft </asp:ListItem> <asp:ListItem Value="http://www.msn.com"> MSN </asp:ListItem> <asp:ListItem Value="http://www.contoso.com"> Contoso Corp. </asp:ListItem> </asp:BulletedList> </ZoneTemplate> </asp:WebPartZone> </div> </form> </body> </html>
After you load the page in a browser, click the verbs menu (represented by a downward arrow) in the title bar of the control that contains the links. In the verbs menu, select Export, and notice that a message box appears with the custom warning. If you want to continue with the export, click OK, which will allow you to save a local copy of an XML description file with all the data about the control.
Available since 2.0