|
List of free web storage providers. Save up to 50 GB online. |
| Active Server Pages: ASP file as a picture source |
We are trying this tutorial to be simple, so in this page we will request imagenes from a ".asp" page, but the imagen will not be newly generated. The images will be already saved in our server .
First, let´s check this two pages:
| showpicture.html | |
| <html>
<title>My picture</title> <body> <img src=mypicture.asp> </body>
|
1
2 3 4 5 6 7 8 |
| mypicture.asp | |
| <% response.ContentType ="image/GIF" %>
<!--#include virtual="mypicture.gif" --> |
1
2 |
Let´s try an examples:
A rudimentary banner rotator system
Our page is "mypage.html" and we are requesting a picture to a file named "mypicture.asp". This file will send to the client one of the pictures available (in this case up to 5), and two variables will be set up:
| mypage.html | |
| <html>
<title>My page</title> <body> <a href=adrotatorlink.asp><img src=mypicture.asp NOSAVE></a> </body>
|
1
2 3 4 5 6 7 8 |
| mypictureasp | |
| <%
if session("ad")="" then session("ad")=0 end if if session("ad")=5 then
response.ContentType ="image/GIF"
<% Select Case session("ad") %>
|
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
| adrotatorlink.asp | |
| response.redirect(session("linkto")) | 1 |
"mypage.html"
At "mypage.html" we have include the regular HTML code to show a picture. We have used within the code the instruction "NOSAVE", so the picture will not be saved in the clients cache.
"mypicture.asp"
After clicking the corresponding picture, and as we have already save the corresponding URL at session('linkto"), we will redirect the visitor to the correct URL.NOTE: By using "NOSAVE" code in our page, the client will no save the picture in the cache of the computer. It may be a problem for us: let´s suppose we have include this the same code in several pages within our site. Each time we visit a new page, session ("linkto") will be defined again, but in case the visitor clicks the back bottom of the browser and the picture show is the same one it was shown in our previous visit, when clicking the visitor will be redirect to a non-correct URL.
|
|
Create word search puzzles with your own words
|
Tutorial home page
2008@ AspTutorial.info. All rights reserved.