public string GetRandomImage(string StrDirectory, string StrFileName)
{
Response.Write("Test: GetRandomImage True");
string GetRandomImage;
int IntFileCount = Directory.GetFiles(Server.MapPath(StrDirectory), "*.*", SearchOption.TopDirectoryOnly).Length;
Random Random1 = new Random();
IntFileCount = IntFileCount + 1;
GetRandomImage = StrDirectory + StrFileName + Random1.Next(1, IntFileCount) + ".png";
Response.Write(GetRandomImage);
return GetRandomImage;
}
this code is in my codebehind file (default.aspx.cs). i want to call it from my default.aspx file. I tried to call with
<%# GetRandomImage("images/random/","random_") %>
but i have get error. How can I do this? Thank you for all helper(s) and your help(s).