C# Path.GetTempPath returns "Could not find a part of the path" error
<p>I am downloading a file from an ftp server and saving it to the directory defined in Path.GetTempPath(); however, I'm getting the following error: Could not find a part of the path. </p>

<p>I've confirmed that the path returned is correct: C:\Users\[username]\AppData\Local\Temp. </p>

<p>SYSTEM, Administrators, and [username] all have full control over that directory. I thought the point of the temp directory was that it was open for anything/everyone to save to, but just in case, I gave NETWORK SERVICE Modify permissions as well. (I assume that's the username ASP.NET Dev server uses, but I'm not sure.) </p>

<p>I'm using VS 08 on Vista.</p>

<p>Here's my code:</p>

<pre><code>FtpWebRequest downloadRequest = (FtpWebRequest)WebRequest.Create(
    ConfigurationManager.AppSettings["FTPServer"] + "//" + fileName);

downloadRequest.Credentials = new NetworkCredential(
    ConfigurationManager.AppSettings["FTPUsername"],
    ConfigurationManager.AppSettings["FTPPassword"]);

downloadRequest.Method = WebRequestMethods.Ftp.DownloadFile;

FtpWebResponse downloadResponse = 
    (FtpWebResponse)downloadRequest.GetResponse();

try
{
    Stream downloadStream = downloadResponse.GetResponseStream();

    if (downloadStream != null) 
    {
        logger.Info("File Download status: {0}", 
            downloadResponse.StatusDescription);

        StreamReader downloadReader = new StreamReader(downloadStream);

        try
        {
            if (downloadReader != null)
            {

                StreamWriter downloadWriter = 
                    new StreamWriter(Path.GetTempPath());
                downloadWriter.AutoFlush = true;
                downloadWriter.Write(downloadReader.ReadToEnd());
            }
        }
        finally
        {
            if (downloadReader != null)
            {
                downloadReader.Close();
            }
        }
    }
}
finally
{
    if (downloadResponse != null)
    {
        downloadResponse.Close();
    }
}
</code></pre>

<p>I'd really appreciate any ideas about what I'm doing wrong here.</p>

<p>Thanks!</p>
