Open PDF File from Hyperlink control

G

Guest

Hi. I see a lot of threads regarding this, but none of them seem to present a
solution.

How can I open a PDF document (located outside of the web application), via
a Hyperlink control. Currently I'm setting the NavigateURL property of the
hyperlink equal to the network path to the document, but this doesn't work.

Can anyone offer a solution?

Thanks
Mike
 
C

Cowboy \(Gregory A. Beamer\)

You cannot point to a network location if you are using a drive designation.
If this is an Intranet application, you can use a UNC, but I would not go
this direction unless every person hitting the site has access to that drive
location, or it will break for some.

If you are trying to display a file on the web server, but outside of the
file directory, you would be best to do a google search for creating a file
server or file serving page, or something similar. The basic idea here is
set the MIME type to the correct type for the file you are serving and then
stream out the bits. I will see if I can find a link a bit later.

I saw someone recently who was trying to copy files to a web directory and
link, but that is not the best solution.

One other option is to create a virtual directory in IIS that points to the
file location (if on that server) and link as if it was part of the website.
That works, but you will also have to give access to the web user or it will
not serve the file. You can then use the Membership bits from ASP.NET to
secure the file(s), if necessary.
 
M

Mark Rae [MVP]

How can I open a PDF document (located outside of the web application),
via
a Hyperlink control. Currently I'm setting the NavigateURL property of
the
hyperlink equal to the network path to the document, but this doesn't
work.

That's right - NavigateURL, as its name suggests, needs a URL e.g.
http://.........
Can anyone offer a solution?

Move the PDF into the virtual directory, or place it in a location which is
accessible via a URL...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top