Generating Random images from Directory

Hey guys, here's whats going on. I need to pull from a folder on our webserver and generate a random image based off of the images in that folder.
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

[1023 byte] By [Tryston02] at [2007-12-16]
# 1
Bassicly Random can give any value. Are you sure that you have 100546 file?
MikeChaliy at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
Setting the Image.ImageUrl should produce something like:

<img src="pic.jpg">

Note that the attribute is src not url for image location. I suspect it's a typo because VS 2005 Beta 2 produced code like the above for me.

The problem that you're experiencing is that src has to refer to a URL, not a file path. You can specify a file URL by prepending "file:///" (N.B. 3 slashes, not 2). This will only work if you're running locally. If you want to render a URL that will be accessible via HTTP, you'll want to generate the random picture as above, strip off the filename and then append it to ./Images/random/.

JamesKovacs at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
Thanks James! Would you mind showing me how I would alter the code below:
Random RanNum = new Random();
string[] fileImages = Directory.GetFiles(MapPath(@".\Images\random\"));

RandomImage.ImageUrl = fileImages[RanNum.Next(fileImages.Length)];

Thanks again!
Chris

Tryston02 at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...