title: Path.GetRandomFileName vs Path.GetTempFileName
body: <p>Base on recommendation from <a href="https://msdn.microsoft.com/en-us/library/system.io.path.getrandomfilename(v=vs.110).aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/system.io.path.getrandomfilename(v=vs.110).aspx</a> 
  I have replaced  GetTempFileName with GetRandomFileName to get a name for the temp file. And it cause a problem. Sometimes GetRandomFileName return not a file name but location in System32 folder. And of cause users with no admin rights are having an error that file is not found.
  Do I missed anything? </p>
  
  <p>Here is a code:</p>
  
  <p><code>string tempFileName = Path.GetRandomFileName();
  FileStream tempFileStream = null;
  tempFileStream = File.Open(tempFileName, FileMode.Create, FileAccess.ReadWrite)</code>;</p>
  
  <p>later on when I try to access that file by code:</p>
  
  <pre><code>FileInfo fileInfo = new FileInfo(tempFileName);
  </code></pre>
  
  <p>I have an error: </p>
  
  <blockquote>
    <p>System.UnauthorizedAccessException: Access to the path 'C:\Windows\system32\25ddubwt.qsc' is denied.</p>
  </blockquote>
  
  <p>I realised that when user initiate a program by using menu from Windows/Start button current directory for the application will be System32</p>