473,796 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Top banner change dynamically...

missshaikh
43 New Member
hi friends

I am programming a website which will include ad banners. The requirements are that the banners will be dynamically changing for each page. By this I mean that if there are ten banners in total and each page will always have two banners. So that two of the ten banners will be randomly selected and placed in the webpage. I have this part figured out. the problem I am facing is that they want to have the ability that banner will randomly apper which fatch frmo DB.

To wrap this up I need some ideas of how to make this work the best way possible. Who The ads are changing dynamically...

I am not look for code on this just ideas of how this should work

Thank you
Jun 12 '08 #1
2 1306
Plater
7,872 Recognized Expert Expert
These ads are all regular image files right? I'll tell you what I would do.
I would make a page called say "RandomAd.aspx" . The duty of that page is to randomly select a banner add to display. You can make the page act as a "serve-up" page. So when it picks the add to show, it does something like the following:
Expand|Select|Wrap|Line Numbers
  1. Response.Clear();
  2. Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
  3. Response.ContentType = "image/jpeg";//change to match the image
  4. Response.WriteFile(FileAndPath);
  5. Response.End();
  6.  
Then make your images on your page point to that aspx page. They will randomly everytime.

AND you can use javascript to call refresh to your images, which will call that aspx page, which will produce a new image. you can use the timer functions in javascript to achieve this if need be.
Jun 12 '08 #2
Curtis Rutland
3,256 Recognized Expert Specialist
Using Plater's idea...
You could also use a System.IO.Direc toryInfo object to poll the directory that contains all (and only) your ad images. Then write a method to randomly select one to use.

The benefit of this method is that you can change the files in the directory without having to change your code. If you get new ads, you don't have to change your page.

Or, you could store your images as BLOBs in a database, and select them out to display them. That would work well too.
Jun 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1450
by: Boris ©avc | last post by:
I have a banner exchange commercial on my page. The code from banner provider is in javascript. How can I change that code (the best would be in php) to know who click on my banner? If this would be normal html link i'd put hyperlink to mypage.php and then use header('Location:'.$_GET); on that page. But how to do it if banner is supplied with Javascript code? <div><center> <script language="javascript"
2
3388
by: Derek | last post by:
I have some third party sponsor banners on my website and since installing the entire page pauses loading then displays the whole page. It seems that the page is waiting on the banners. Is there a way to set IIS or coding to load the page and then load the banners if they take longer to load?
0
825
by: Craig Buchanan | last post by:
I have a banner in the form of a web usercontrol that i would like to add to each page in my web app. the WUC is in the root of the virtual directory. the WUC has a link on it that should always be feedback.aspx in the root directory. i need a way to dynamically create this path regardless of which webform is using this WUC and in which subdirectory. Is there a good way to do this? Perhaps manipulating the Server variables? Thanks, ...
4
1966
by: Patrick Rouse | last post by:
Please point me to the correct newsgroup if this is the wrong place to post this question. My website is written in simple HTML and hosted on a windows server at secureserver.net (via GoDaddy). I use an ASP Web Stats program called Power-Stats to track my website traffic, search keywords... The data is stored in an Access Database hosted on my website. I'd like to be able to track how many clicks I get on each of my banner ads,...
3
2316
by: | last post by:
I want a banner to appear at the bottom of each page of a web app. I created a user control that describes the banner and have it placed in all my pages. For the most part it functions as needed. The exception is when the content of the web page is longer than the screen. The user has to scroll for the full content, but the bottom banner still appears at the bottom of the screen, so it appears across the main body content on small...
2
2058
by: Tim Chase | last post by:
A couple of hopefully short (interrelated) questions: 1) is there a way to suppress the banner when starting Python interactively? Something like a "--quiet" that would just drop you straight to a prompt? I like to use Python as a nuclear-powered calculator, and am working on a couple little projects where it would be quite handy to suppress the banner version/help information (namely, if it gets piped to a text-to-speech front end,...
3
1395
by: Kevin Raleigh | last post by:
looking for a rotating ad banner that shows a new image say every 15-20 seconds. can you suggest something that I might be able to use. NOTE: This is for my church so if it were free I won't have to pay out of pocket. Thank You Kevin
13
2394
Death Slaught
by: Death Slaught | last post by:
I have my entire page in my "main" div. div.main { width: 100%; height: 100%; border: 1px solid gray; } on the left of the page I have a banner.
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.