title: Validate a path
body: <p>Is there any way of validating if a path can be correct in .net or do I need to write something myself?</p>
  
  <p>What I have is a string that is supposed to be a valid path such as:</p>
  
  <pre><code>\\server\shared\folder\file.ext
  c:\folder\file.ext
  .\folder\file.ext
  \folder\file.ext
  %appdata%\folder\file.ext
  </code></pre>
  
  <p>The path does not need to exist on the machine where this is run and the network does not need to be accessible, I'm only interested to see if the path could ever be valid.</p>
  
  <p>Was thinking about splitting the path into filename and path and then using the Path.GetInvalidPathChars() and Path.GetInvalidFileNameChars() arrays to check if the path contains invalid filenames which would at least be a start. But there may be better ideas?</p>