Generating Random images from Directory
Using VS 2005 by the way.
Here's what I have:
--
Random RanNum = new Random();
string[] fileImages = Directory.GetFiles(MapPath(@".\Images\random\"));
RandomImage.ImageUrl = fileImages[RanNum.Next(fileImages.Length)];
--
This is my physical path to where the files are:
C:\Chris.Peele\My Documents\Visual Studio 2005\WebSites\HighSide\Images\random
RandomImage is the id of the <asp:Image> control.
It doesn't output the images just the little red X
When I view the page source in the browser or in the debugger it shows: <img url="C:\Chris.Peele\My Documents\Visual Studio 2005\WebSites\HighSide\Images\random\blah.gif">
I have no idea what is causing this but it has something to do with paths (I think).
Thanks guys!
Chris

