FileDialog.SafeFileName Property

Gets a string that only contains the filename for the selected file.

Namespace: Microsoft.Win32
Assembly: PresentationFramework (in presentationframework.dll)

public string SafeFileName { get; }
/** @property */
public String get_SafeFileName ()

public function get SafeFileName () : String

You cannot use this property in XAML.

Property Value

A String that only contains the filename for the selected file. The default is Empty, which is also the value when either no file is selected or a directory is selected.

This value is the FileName with all path information removed. Removing the paths makes the value appropriate for use in partial trust applications, since it prevents applications from discovering information about the local file system.

If more than one filename is selected (length of SafeFileNames is greater than one) then this property contains only the first selected filename.

See Safe File Upload from an XBAP Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: