如果图像网址包含+符号,则显示图像 [英] Display image if the image url contains + symbol

查看:146
本文介绍了如果图像网址包含+符号,则显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string imagepath = @photos \ PRIUS + \5MM.jpg;

Img.ImageUrl = imagepath;



这里我想设置图片网址,但路径有+符号。即PRIUS +下的文件夹名称照片是子文件夹,5MM.jpg是要显示的图像。



任何帮助都可以被欣赏。



我尝试了什么:



我在web.config中尝试过allowDoubleEscaping =true。但它打开了安全整体。所以没有命令。我可以用任何其他方式显示图像吗?

< security>

< requestFiltering allowDoubleEscaping =true/>





任何人都可以帮我解决这个问题。

string imagepath = @"photos\PRIUS+\5MM.jpg";
Img.ImageUrl = imagepath ;

Here I wanted set the image url, but path have + symbol. i.e folder name photos under that PRIUS+ is sub folder, 5MM.jpg is image to display.

Any help can be appreciated.

What I have tried:

I have tried allowDoubleEscaping="true" in web.config. But it opens the security whole. So not commanded. Any alternate way I can display the image?
<security>
<requestFiltering allowDoubleEscaping="true"/>


Can any one help me to fix this issue.

推荐答案

你可以直接使用路径,如

You can directly use the path like,
string imagepath = @"photos\PRIUS+\5MM.jpg";



它会起作用。我也试过了。


It will work. I've also tried.


这篇关于如果图像网址包含+符号,则显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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