2

I have an issue where pdf files don't open on edge when they come from a WebDAV address.

I have noticed however that if I hit the file directly using the url for the file the pdf opens correctly as required.

I was wondering if there is a way to convert either of the following paths into the url required.

Paths I have:

  • Z:\Folder\TestPDF.pdf

  • \\127.0.0.1@1234\DavWWWRoot\Folder\TestPDF.pdf

URL I want

Community
  • 1
  • 1
user3284707
  • 3,033
  • 3
  • 35
  • 69

1 Answers1

0

You can use URI class

var uri = new System.Uri(@"Z:\Folder\TestPDF.pdf").AbsoluteUri;

The result is URI path what you want: file:///Z:/Folder/TestPDF.pdf

Alex Pashkin
  • 301
  • 4
  • 15