w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
c# illegal character in file path

Use

filePath = string.Format(@"{0}"{1}", appData,
model.File.FileName);

The @ char show the compiler that the string doesn't have any backslashed characters. Normaly, you use the prefix in some special chars, like means a newline. You string has a , so the compiler tries to resolve it with the next char in the string.

Another way is to escape the backslash with the second one, like this:

filePath = string.Format(@"{0}\"{1}", appData,
model.File.FileName);




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.