Am looking to design a web part that will display a link for a user to download a PDF file. This is stored as a BLOB in SQL Server. This web part would be connected to another Sharepoint list where the user selects an item and this web part would display a link to view/download the file(s) if there are any.

Running Sharepoint Foundation 2010. Is there any way to do this? I am a novice at developing anything for Sharepoint (just created my first web part all by myself!) and would appreciate any assistance.

Thank you.



So the problem here is that a blob in SQL Server is not hyper-linkable. Your web part can generate a link, but what would the link point to - it has to be a resource a Web Server can actually address.

To solve this problem, you need need an intermediary between the hyperlink and the SQL Blog. Example - your web part provides a hyper-link to a custom page that takes a query parameter with the unique ID of the blog in SQL, and the custom page queries SQL Server and renders out the data with the correct HTTP headers so the browser thinks its a file.

I have seem similar requests for this in the past, but I have not come across a code sample.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.