Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Could not find a part of the path /C:\\Users Blazor

$
0
0

Could not find a part of the path '/C:\Users....

I have been getting this error message for days and I have no idea how to fix it. I am in a try-catch block and the path with the /C only appears in the exception.Message. Before that, the string with the file path is always displayed correctly.

This is what I get from the error message:'Could not find a part of the path '/C:\Users\Siphi\Documents\CSV Datein'.'

Why does the program always put a slash in front of the C ?

I program the whole programm with C# in Blazor web app here is the method in which I call the file path:

       private List<string> GetFilePath(string path, string customerName, string language)    {        try        {        DirectoryInfo d = new DirectoryInfo(path);        fileNames.Clear();        string foundFile = string.Empty;        FileInfo[] files = d.GetFiles("*.csv"); //Getting Text files        foreach (FileInfo file in files)        {                        if (file.Name.Contains(customerName +"_" + language))            {                fileNames.Add(file.Name);                foundFile = file.FullName;            }        }        return fileNames;        }        catch (Exception exception)        {            NoAcepetion = false;            isDisabled = true;            ErrorMessage = exception.Message;            return fileNames;        }    }

does anyone have an idea what I could do ?


Viewing all articles
Browse latest Browse all 4839

Trending Articles