Display image from database in ASP.net with C#

前端 未结 4 1502
醉话见心
醉话见心 2020-11-29 11:36

I know this kind of question has been asked many times. Yet I don\'t succeed in displaying an image from my db on a page.

I tried the following method.



        
4条回答
  •  误落风尘
    2020-11-29 12:16

    There's an error in your path reference...

    ImageUrl="/~givememypicture.aspx?pic=3"
    

    should be:

    ImageUrl="~/givememypicture.aspx?pic=3"
    

    ~ is shorthand for "the application root" and needs to be followed by a slash to indicate that it's a directory. Think of it as similar to other path shorthand notations such as . and ...

提交回复
热议问题