Assembly: System.Web (in system.web.dll)
/** @property */ public String get_ExportSensitiveDataWarning () /** @property */ public void set_ExportSensitiveDataWarning (String value)
public function get ExportSensitiveDataWarning () : String public function set ExportSensitiveDataWarning (value : String)
Property ValueA string that contains the warning message. The default message is a culture-specific value supplied by the .NET Framework.
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 the ExportSensitiveDataWarning property, you can provide a custom warning message.
The following code example demonstrates the declarative use of the ExportSensitiveDataWarning property.
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#" %> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> </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> </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.
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.