Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Response.Write--如何显示图像_C#_Image_Response.write - Fatal编程技术网

C# Response.Write--如何显示图像

C# Response.Write--如何显示图像,c#,image,response.write,C#,Image,Response.write,这是我的图片Url string fileUrl = file.Link; 我想在Response.Write.How上显示这一点 Response.Write("<img src='" & fileUrl& "'/>") Response.Write(“”) 上面的代码我试过了。但它不起作用。让文件路径包含虚拟地址,如图所示 string filePath = "http://localhost:2053/Styles/Images/myPersonalIm

这是我的图片Url

string fileUrl = file.Link;
我想在Response.Write.How上显示这一点

Response.Write("<img src='" & fileUrl& "'/>")
Response.Write(“”)

上面的代码我试过了。但它不起作用。

文件路径包含虚拟地址,如图所示

string filePath  = "http://localhost:2053/Styles/Images/myPersonalImage.jpg"
Response.Write("<img src='" & filePath & "'/>");
string文件路径=”http://localhost:2053/Styles/Images/myPersonalImage.jpg"
回答。写(“”);

您需要使用Server.MapPath

string fileUrl = Server.MapPath(file.Link);
而且是&。。。 它可以通过使用+替换来正常工作

Response.Write("<img src='" + fileUrl+ "'/>")
Response.Write(“”)

图像不在本地主机上。我正在从外部站点获取它。我成功地将映像存储在本地计算机上。但是我需要在我的项目中显示属性
Link
?@BlackFrog中的内容。我正在从外部站点和文件拍摄图像。Link从外部站点返回ImageLink。我成功地将图像存储在本地计算机上。但我需要在我的项目中展示它,应该是什么样的内部响应?