I'm getting the above error when trying to print a file with my Xamarin app through call to a web service method. When same method is called from browser it prints without problem. Write and read permissions for external storage are granted. The file I want to print is located in a shared network folder. What could be the reason that folder access is denied only for the app?
That's the part of the code where filepath is used:
public static string SubstituteFileContent(string filePath, string substituteValues)
{
var rdr = new StreamReader(filePath);
var fileContent = rdr.ReadToEnd();
//textBoxSource.Text = fileContent;
var index = fileContent.IndexOf("^XA");
fileContent = fileContent.Remove(0, index);
var start = fileContent.IndexOf("^DFE");
var end = fileContent.IndexOf(".ZPL^");
fileContent = fileContent.Remove(start, end - start + 4);
rdr.Close();
var substitutedContent = SubstituteFields(fileContent, substituteValues);
return substitutedContent;
}
Ok, solved it myself. I had to explicitly share the network folder with "Everyone" under Share settings.