0

im creating temporary files to be stored in the Temp folder found by:

string path = System.IO.Path.GetTempPath() method returns C:\windows\Temp\

i append my filename:

string filename = myfile.txt
System.IO.Path.Combine(path,filename)

However, this gives me a

"Message":"The given path\u0027s format is not supported.","StackTrace":" at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)\r\n at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)\r\n at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)\r\n at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, AccessControlActions...... and so on

I have tried modifying the rights to the TEMP folder, so that NETWORK SERVICES has rights.. Any ideas?

matskn
  • 1,290
  • 6
  • 17
  • 30
  • Are you sure that code is correct? I would believe that at least one correction would be `string filename = "myfile.txt";` not `string filename = myfile.txt` – Lazarus Oct 05 '10 at 13:19

1 Answers1

2

Your path contains an invalid character. Unicode code is 0027 which is a single quote "'" so you need to check where you are adding a single quote to the path.

Aliostad
  • 80,612
  • 21
  • 160
  • 208
  • Correct! Was a Date.Now() with minutes and hour that did the damage! Solved now! Thanks alot – matskn Oct 05 '10 at 13:47