如何在C#ASP.Net的Image Box中显示图像? [英] How to display image in Image Box in C# ASP.Net?
本文介绍了如何在C#ASP.Net的Image Box中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我使用此代码显示图像,不在图像框中显示。
Image1.ImageUrl = Server.MapPath(@〜/ Images / 4.jpg);
请帮帮我。
谢谢
Ankit Agarwal
软件工程师
Hello,
I am using this code for display image its not displaying in Image Box.
Image1.ImageUrl = Server.MapPath(@"~/Images/4.jpg");
Please help me.
Thanks
Ankit Agarwal
Software Engineer
推荐答案
使用
Image1.ImageUrl = "~/Images/4.jpg";
MapPath将提供本地路径,但ImageUrl需要相对于绝对 URL
试试这个
http:/ /stackoverflow.com/questions/14296825/how-to-set-image-url-as-absolute-physical-path [ ^ ]
这篇关于如何在C#ASP.Net的Image Box中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文