The given path format is not supported.

G

Guest

I have a windows service that reads an encrypted password out of a file
located locally on the server. When it attempts to use the following code,
it gets the error listed above.

StreamReader myFile =new StreamReader(Filename, System.Text.Encoding.UTF8);

This code works locally on my machine as well as my DEV, TEST, and STAGE
servers. I have been attempting to move this code to the PROD servers, but
it fails when attempting this line of code.

Additional Info:
The windows service runs under the Local System account. The FileName
parameter looks something like @"D:\timertask\timertaskservice\Password.txt".
I have investigated every related article I could find including validating
the System environmental variables for TMP and TEMP.

Complete Error:

System.NotSupportedException: The given
path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String
path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.AddExpressions(String[]
str, Boolean checkForDuplicates, Boolean needFullPath)
a
System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess
access, String[] pathListOrig, Boolean checkForDuplicates, Boolean
needFullPath, Boolean copyPathList)
at
System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess
access, String[] pathList, Boolean checkForDuplicates, Boolean
needFullPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding,
Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding)
at Encryption.ClsEncryption.Get_Password_From_File(String Filename)
 
J

Jon Skeet [C# MVP]

<"=?Utf-8?B?SmVzc2UgU2FuZGVycw==?=" <Jesse
I have a windows service that reads an encrypted password out of a file
located locally on the server. When it attempts to use the following code,
it gets the error listed above.

StreamReader myFile =new StreamReader(Filename, System.Text.Encoding.UTF8);

This code works locally on my machine as well as my DEV, TEST, and STAGE
servers. I have been attempting to move this code to the PROD servers, but
it fails when attempting this line of code.

Additional Info:
The windows service runs under the Local System account. The FileName
parameter looks something like @"D:\timertask\timertaskservice\Password.txt".
I have investigated every related article I could find including validating
the System environmental variables for TMP and TEMP.

That sounds very odd. Can you get it to print out the filename it's
trying to use before opening the file? My guess is that the parameter
has been corrupted somewhere.
 
S

Scott

Is d:\ in this example a mapped drive? The local system account probably
wouldn't know anything about it if it was mapped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top