StringBuilder sb = new StringBuilder();
sb.Append("window.onload = function picture()\n{\n"
);
sb.Append("var pictures = new Array();\n"
);
FileInfo[] files = new DirectoryInfo(Server.MapPath("./images/"
)).GetFiles();
for (int i = 0
; i < files.Length; i++)
   sb.Append(string.Format("pictures[{0}] = 'images/{1}';\n"
, i, files[i].Name));
sb.Append("var number = Math.floor(Math.random() * " + files.Length + ");\n"
);
sb.Append("document.getElementById('" + Image1.ClientID + "').src = pictures[number];\n"
);
sb.Append("setTimeout('picture()',1000);\n}"
);

ClientScriptManager
cn = Page.ClientScript;
if (!cn.IsStartupScriptRegistered("picture"
))
   cn.RegisterClientScriptBlock(typeof(Page), string.Empty, sb.ToString(), true
);

Yorumlar
Ekleyen
hocam tam süper olmuş tam size bu konuda danışacaktım :)