I am wanting to access a virtual folder, but when I want to establish the path, all the "" are multiplied.
I want the path to be " \\carpetaVirtual\carpeta\archivo
" but when multiplied I get " \\\\carpetavirtual\\carpeta\\archivo
". I've been searching the internet, forums and documentation but couldn't find an explanation.
It's a C# ASP.NET MVC project.
I have tried using areplace
path = "//carpetaVirtual/carpeta/" + archivo;
path = path.replace("/", "\")
but even if I change it, it continues to multiply.
paths are written with backslashes "\" (escape symbol for the compiler) but these are reserved by the C# language so you need to escape by typing another "\" so we would be left with "\\" so if you want to write a path it should be written this way
You can also write it this way, adding an at sign to the beginning of the string with this you tell the compiler that you are escaping the reserved characters
If you look at this example the compiler automatically adds another "\" to escape the reserved character "\" so when you do the split("/","\") the compiler will insert another "\" for each "\" have the string