string TempFilename = System.IO.Path.GetTempFileName();
However this will return a unique temporary filename but it also creates an empty file on disk (zero bytes) which is okay if you are prepared to manage deletion or re-use yourself. This method is actually making the following call to managed code.[DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] internal static extern uint GetTempFileName(string tmpPath, string prefix, uint uniqueIdOrZero, StringBuilder tmpFileName); public static string GetTempFileName() { string text1 = Path.GetTempPath(); StringBuilder builder1 = new StringBuilder(260); uint num1 = Win32Native.GetTempFileName(text1, "tmp", 0, builder1); if (num1 == 0) { __Error.WinIOError(); } return builder1.ToString(); }However I would not use this if your requirements involve multiple threads and avoiding race conditions then Cetin's idea of using a GUID is a much more reliable solution.