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?
cdakzAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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. LevineDon't talk to me.Commented:
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:

http://www.yoursite.com/downloadafile.php

$file_url = 'http://www.yoursite.com/dont/browse/to/this/file.exe';
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary"); 
header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); 
readfile($file_url); 

Open in new window

cdakzAuthor Commented:
I get the gist, but am familiar with asp.net/c#, 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. LevineDon't talk to me.Commented:
Sorry, I don't work on Windows.  I will add those topics to your question so those Experts will see it.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook 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:
www.prideparrot.com/blog/archive/2012/8/uploading_and_returning_files#how_to_return_a_file_as_response

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. LevineDon't talk to me.Commented:
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.