Assad Nazar
Assad Nazar

Reputation: 1464

load images from a folder

I want to load images from a folder located 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.

Upvotes: 0

Views: 1517

Answers (1)

Doobi
Doobi

Reputation: 4822

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

Upvotes: 1

Related Questions