DownloadLink

  • Thread starter Thread starter gh
  • Start date Start date
G

gh

I have an asp.net website and was going to add a folder so the user
could download a file to there pc. I would like for them to click a
link, enter a password and have the file automatically download. The
password would be the same for everyone and I would change it
frequently. Anyone have a way to do this?

Thanks
 
Design a page with an password text box and a button to submit the pwd. On
the server-side, validate the password and then have the following code:

Response.Clear ();
Response.ContentType = "application/octet-stream";
Response.AddHeader ("Content-Disposition", "attachment;filename=Test.exe");
Response.WriteFile (@"C:\Test.exe");

HTH.
 
Back
Top