Last post Oct 13, 2016 08:53 PM by Mikesdotnetting
Oct 13, 2016 04:26 PM|Ravina|LINK
I was hoping someone might be able to help me with this. I have a file stored in the sql database as a byte(). I have retreived it but how do I add it to a hyperlink stored in a grid? I want the user to be able to click on the hyperlink and the file to open.
Thanks in advance,
Oct 13, 2016 08:53 PM|Mikesdotnetting|LINK
The hyperlink should point to a handler file that gets the bytes from the database and uses Response.BinaryWrite to send them to the browser. the handler will be a .ashx file (Generic Handler) if you are using web forms, a cshtml file if you are using Razor
Web Pages, or an MVC FileResult if you are using MVC.
Web Pages: http://www.mikesdotnetting.com/article/148/save-and-retrieve-files-from-a-sql-server-ce-database-with-webmatrix
Web Forms: http://www.mikesdotnetting.com/article/123/storing-files-and-images-in-access-with-asp-net