For OpenFileDialog,
What are the differences between SafeFileNames and FileNames?
and Why is SafeFileNames
is safe
?
For OpenFileDialog,
What are the differences between SafeFileNames and FileNames?
and Why is SafeFileNames
is safe
?
The answer is right there on the pages you linked. The "safe" filename doesn't include the path. Just the filename and the extension. The regular filename includes the full path.
The SafeFileName is safe because it doesn't expose the directory structure of your computer.
The main difference is that FileNames
requires FileIOPermissionAccess.AllAccess
security permissions, since it's returning path information about the system into the process. A user running with very low trust permission sets will trigger security exceptions if you try to access FileNames
, as the path information is not available.
With SafeFileNames
, the property "should be accessible to code running with limited trust." It's "safe" in terms of being able to be used with limited rights.