| |
GeekInterview.com > Interview Questions > Microsoft > ADO.NET 2.0
| Print | |
Question: how we can show image from database to our web form
|
| March 03, 2009 12:25:14 |
#4 |
| ajayms2000 |
Member Since: March 2009 Total Comments: 2 |
RE: how we can show image from database to our web form |
What I understand from your question is that, you have the image content in your data base and wants to read it from there and show it to web page.
If I am right in my perception, then a simple solution would be as follows.
Setup a virtual directory and give it necessary write permission for (Network Service if u r using unauthorized access. otherwise for the user under which you application runs in windows authentication mode).
Read the image content from the database into a byte array (byte[]). Now create a filestream object with a new filename targeting the early mentioned folder. Now write your array to the stream. Flush the stream and dispose it. Now you can easily build relative/absolute url for that file and bind it to your image control in your page. |
| |
Back To Question | |