Mvc控制器显示图像 [英] Mvc controller display image

查看:80
本文介绍了Mvc控制器显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



i fetch错误认为绑定D驱动到mvc中的图像

错误: - 不允许加载本地资源

路径:

file:/// D:// Tradebulls//KYC//Equity//PAN%20Card//12345678//023912_Chrysanthemum.jpg



我尝试过:



sb.AppendFormat(< br> < img src ='{0}'alt =''height = 300px width = 100%>< / img>,dr [dc] .ToString(),image / png);

hello,

i fetch error thought bind D drive to image in mvc
Error: - "Not allowed to load local resource"
Path:
file:///D://Tradebulls//KYC//Equity//PAN%20Card//12345678//023912_Chrysanthemum.jpg

What I have tried:

sb.AppendFormat("<br><img src='{0}' alt='' height=300px width=100%></img>", dr[dc].ToString(), "image/png");

推荐答案

并非所有浏览器都允许这样做,无论如何,这是一个坏主意,您的服务器端代码如何知道客户端PC上可用的文件?您可能正在做一些只有在您的本地计算机上进行开发和部署的工作,但在将您的站点部署到实际服务器时将停止工作。
Not all browsers will allow this, and it's a bad idea anyway, how does your server-side code know what files are available on the client's PC? You're probably doing something that only works because you're developing and deploying on your local machine, but will stop working when you deploy your site to an actual server.


这篇关于Mvc控制器显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆