ASP.NET,img显示FTP的图片

<img id="imgEntering"  src="ftp://192.168.1.10/Pictures/201607221-%C8%AB%BE%B0%CD%BC.jpg" style="width:auto;height:300px" />

这样可以直接显示出来,
但,数据库存的URL是
ftp://192.168.1.10/Pictures/201607221-全局图.jpg
,需要编码。
后台

string strUrl="ftp://192.168.1.10/Pictures/201607221-全局图.jpg";
 System.Web.HttpUtility.UrlEncode(System.Web.HttpUtility.HtmlEncode(strUrl), Encoding.GetEncoding("GB2312"));

他会把“/”也给编码了

获取文件名进行编码,不要对整个变量

 string strUrl="ftp://192.168.1.10/Pictures/201607221-全局图.jpg";
 string name = System.IO.Path.GetFileName(strUrl);

Response.Write(strUrl.Replace(name,"")+ System.Web.HttpUtility.UrlEncode(System.Web.HttpUtility.HtmlEncode(name), Encoding.GetEncoding("GB2312")));