How to force a file download?
-
I am in need of some help, there doesn't seem to be much advice covering what i need to do :( My site uses authentication for different subscriptions. I need to allow users to download files based on their role. I don't want to link to a URL becuase that url can be passed around. How can I force a file to be downloaded but not reveal it's location on the server? Definitely a PEBCAK! (Problem Exists Between Keyboard And Chair)
My First ASP.Net site is now up :) RedRavenRPG -
I am in need of some help, there doesn't seem to be much advice covering what i need to do :( My site uses authentication for different subscriptions. I need to allow users to download files based on their role. I don't want to link to a URL becuase that url can be passed around. How can I force a file to be downloaded but not reveal it's location on the server? Definitely a PEBCAK! (Problem Exists Between Keyboard And Chair)
My First ASP.Net site is now up :) RedRavenRPGHi, try this in code behide: response.redirect("yourfile.zip") Juno MCSD.NET, MCDBA, MCSE ---------------------------------------------------------- Support Team of EasyDotNet, INC. http://www.EasyDotNet.com DataForm.NET - The most powerful data entry web server control for ASP.NET
-
Hi, try this in code behide: response.redirect("yourfile.zip") Juno MCSD.NET, MCDBA, MCSE ---------------------------------------------------------- Support Team of EasyDotNet, INC. http://www.EasyDotNet.com DataForm.NET - The most powerful data entry web server control for ASP.NET
Or you could use as asp.net page to stream the content out. You would have to load the file into a stream, then write the bytes out to the response using Request.BinaryWrite() This way you could do extra checking etc before actually streaming the file, like ensuring the person has come from your website first etc.