Hello, I'm creating my first website using master pages and asp.net. As part of this project, I need to display a random banner image at the top of each web page.

Let's say i have an "images" directory with image1.jpg, image2,jpg, image3.jpg and image4.jpg.

In the past, I have used PHP to easily display a random image using this format: <img src="images/image<?php echo(rand(1,4)); ?>.jpg" /> This selects a random image ending with a number between 1 and 4.

Is there a way to do this in an asp.net website (either VB or C#) that is as simple as the PHP solution?

Thanks!

in asp.net you dont need to code that thing, there is an adrotator control that does it automatically for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.