How to provide a hyperlink to file without revealing path?

I need to provide an href / hyperlink in a web browser to a file, so that the user can open/download it, but NOT provide the full path to the file (for security reasons).

What's the best way to do this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
Link to a server-side script of some sort that includes the file from another location and sends it back to the user.

Something like this:

$file_url = '';
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary"); 
header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); 

Open in new window

cdakzAuthor Commented:
I get the gist, but am familiar with, so the php isn't clear.

Suggestion on how to do this in C# on ASP.NET? (Sorry I didn't say so in the beginning).
Jason C. LevineNo oneCommented:
Sorry, I don't work on Windows.  I will add those topics to your question so those Experts will see it.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

David Johnson, CD, MVPOwnerCommented:
use a virtual directory. http::\\sitename\path can point anywhere on that server.
cdakzAuthor Commented:
Jason C. Levine's suggestion pointed me in the right direction, even though it was from the LAMP world. I had in my head to somehow fool an <a href... tag to pull this off, which was wrong.

As it turns out, this is almost trivially simple in the ASP.NET MVC world (after looking in the right direction).

Here are 2 references if anybody else wants to know how to implement this using ASP.NET MVC:

MSDN's FileResult documentation

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason C. LevineNo oneCommented:
Thanks, cdakz.  Happy that I got you looking in the right direction.
cdakzAuthor Commented:
Selected my solution because it was the ASP.NET MVC solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.