TAGS :Viewed: 9 - Published at: a few seconds ago

[ File path issue ]

var bytes = System.IO.File.ReadAllText ("\\\\hds321\\Common Pay Sal\\Mobile App\\Android\\abc.pdf");

The above line errors out as :

Could not find file "/\hds321\Common Pay Sal\Mobile App\Android\abc.pdf".

Tried using a single \ instead of including the escape \. Still the same issue.

The file exists in the shared path specified.

Any resolutions please?

Answer 1


I recommend using Path.Combine(), instead of trying to concat path names manually. Path.Combine() will take care of the nuances of your platform for you.

Answer 2


The Xamarin utility assumes the path being accessed in on an SD card. Network paths cannot be used while developing code. Wish the error was clearer