2

The following code always shows path manipulation problem. How to resolve it ?

string pathMaterData = ServerName + "\\MaterData\\";
if (!Directory.Exists(Path.Combine(ServerName, "\\MaterData\\")))
{
    Directory.CreateDirectory(Path.Combine(ServerName, "\\MaterData\\"));
}

This line code problem only

 Directory.CreateDirectory(Path.Combine(ServerName, "\\MaterData\\"));
Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99
Jamebond Tkk
  • 73
  • 1
  • 6

1 Answers1

0

Its hard to say without seeing what results you are getting, but it looks like maybe you are over qualifying the path with slashes.

Try this

string pathMaterData = Path.Combine(ServerName, "MaterData")

if (!Directory.Exists(pathMaterData))
{
  Directory.CreateDirectory(pathMaterData);
}
swestner
  • 1,881
  • 15
  • 19