mercredi 17 février 2016

Why am I getting, "URI formats are not supported" with this code?

I have this code that should assign a string path value to the "uripath" string variable:

private readonly FileStream _fileStream;

. . .

string uriPath = GetExecutionFolder() + "\\AppLogMsgs.txt";
_fileStream = File.OpenWrite(uriPath); 

. . .

private string GetExecutionFolder()
{
    return Path.GetDirectoryName       
(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
}

...but it crashes when trying to execute the "_fileStream = File.OpenWrite(uriPath);" line.

Why, and what do I need to do to rectify this revoltin' development?

The value of "uriPath" when it crashes is:

file:\C:\Projects\ReportScheduler\ReportScheduler\bin\Debug\AppLogMsgs.txt





Aucun commentaire:

Enregistrer un commentaire