load images from a folder
I want to load images from a folder loca开发者_如何学Goted on my server eg. webimages and its located in my web root. How can i load these images without predefining paths in XML or database?
I mean, if i add some image in the webimages, my code should automatically load the images from this folder. All i need to tell the code is to point to that folder and it should return me all the images in that folder.
You use the MapPath Function to return the underlying folder:
http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx
And use the Directory class to get the contents of the Folder:
http://msdn.microsoft.com/en-us/library/system.io.directory(v=VS.100).aspx
精彩评论