How do you get the current image name from an ASP.Net website?
<p>Scenario: You have an ASP.Net webpage that should display the next image in a series of images. If 1.jpg is currently loaded, the refresh should load 2.jpg.<br />
Assuming I would use this code, where do you get the current images name.</p>

<p><code>
string currImage = MainPic.ImageUrl.Replace(".jpg", "");<br />
currImage = currImage.Replace("~/Images/", "");</p>

<p>int num = (Convert.ToInt32(currImage) + 1) % 3;<br />
MainPic.ImageUrl = "~/Images/" + num.ToString() + ".jpg";
</code></p>

<p>The problem with the above code is that the webpage used is the default site with the image set to 1.jpg, so the loaded image is always 2.jpg.<br />
So in the process of loading the page, is it possible to pull the last image used from the pages properties?</p>
