Returns a random folder name or file name.
Namespace:
System.IO
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Shared Function GetRandomFileName As String
Dim returnValue As String
returnValue = Path.GetRandomFileName()
public static string GetRandomFileName()
public:
static String^ GetRandomFileName()
public static function GetRandomFileName() : String
The GetRandomFileName method returns a cryptographically strong, random string that can be used as either a folder name or a file name. Unlike GetTempFileName, GetRandomFileName does not create a file. When the security of your file system is paramount, this method should be used instead of GetTempFileName.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference