在ASP中显示图像:图像ASP.NET C# [英] Display image in ASP:image ASP.NET C#
问题描述
在我的sql server db中我有字段名stuimage类型图像
i想在asp中显示这个图像:asp.net中的图像id =image1c#
使用此代码
byte [] bytes =(字节跨度> [])x.Student_Picture;
string imgString = Convert.ToBase64String(bytes);
Image1.ImageUrl = String .Format( data:image / jpeg; base64,{0},imgString);
当我运行此代码时
。 .. image1出现空白
哪里有错误以及如何解决?
最好的问候
我的尝试:
-----
byte [] imagem =(byte [])x.Student_Picture;
string base64String = Convert.ToBase64String(imagem,0,imagem.Length);
images1.Src =data:image / jpeg; base64,+ base64String;
------------
您好,请从这些链接获取帮助,
提前感谢
显示图像控件中的数据库中的图像,而不使用ASP.Net中的Generic Handler [ ^ ]
c# - 从asp.net中的数据库中检索图像 - Stack Overflow [ ^ ]
in my sql server db i have field name stuimage type image
i wanna display this image in asp:image id = "image1" in asp.net c#
using this code
byte[] bytes = (byte[])x.Student_Picture;
string imgString = Convert.ToBase64String(bytes);
Image1.ImageUrl = String.Format("data:image/jpeg;base64,{0}",imgString );
when i run this code ... image1 is appeared empty
where is the error and how to solve it ?
best regards
What I have tried:
-----
byte[] imagem = (byte[])x.Student_Picture;
string base64String = Convert.ToBase64String(imagem, 0, imagem.Length);
images1.Src = "data:image/jpeg;base64," + base64String;
------------
Hi, take help from these links,
thanks in advance
Display image from database in Image control without using Generic Handler in ASP.Net[^]
c# - Retrieve image from database in asp.net - Stack Overflow[^]
这篇关于在ASP中显示图像:图像ASP.NET C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!