我想在C#In Repeater中检索Image [英] I want to retrieve Image in C# In Repeater
本文介绍了我想在C#In Repeater中检索Image的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我想在asp.net的转发器中检索图像来自目录
那里是一个文件夹,其中包含已修复的文档和类别名称,但在类别文件夹下有一个名称为类别Id的目录,在类别ID下,有一个名称为子类别ID的目录我想从子类别中检索图像目录。
Hi
I want to retrive image in repeater in asp.net From Directory
There is a folder with a Name of documents and category that is fixed ,but under category folder there is a directory with a name of category Id and Under Category Id there is a directory with a name a of subcategory Id i want to retrieve Image from Subcategory Directory.
string path = Path.Combine(Server.MapPath(@"~/Documents/Category/Cat_Id/Sub_Cat"+ ext));
Directory.GetFiles(path);
</pre>
推荐答案
为什么使用Path.Combine,然后只传递它一个参数?
Why are you using Path.Combine, and then only passing it one parameter?
string path = Path.Combine(Server.MapPath(@"~/Documents/Category/Cat_Id/Sub_Cat"+ ext));
如果你通过两个问题,你的问题可能会消失...
You problem may go away if you pass two...
string path = Path.Combine(Server.MapPath(@"~/Documents/Category/Cat_Id/Sub_Cat"), ext);
如果图像在您的网站空间之外,您无法使用http直接为它们提供服务,因此您需要使用处理程序将它们推送到客户端。您可以重复使用此链接中的大部分代码
http:// aspalliance.com/1322_Displaying_Images_in_ASPNET_Using_HttpHandlers.all [ ^ ]
您只需将其从数据库路径更改为文件夹结构。
If the images are outside of your webspace you can't server them directly using http so you'll need to push them to the client using handlers. You can re-use most of the code from this link
http://aspalliance.com/1322_Displaying_Images_in_ASPNET_Using_HttpHandlers.all[^]
you'd just need to change it from getting the path from a database to your folder structure.
这篇关于我想在C#In Repeater中检索Image的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文