I don't quite understand what you mean.
See, I want to call a page. If no input is given, home.asp should be parsed.
If an input is given, it should be checked if the file exists, if it doesn't
parse home.asp again. If the file does exists, parse that file.
So my logic is right.......
linkname=advert123 - (i.e
http://localhost/index.asp?l=advert123)
if linkname not empty then - (i.e the variable linkname
contains something)
ipage = linkname & ".html" - make the page the contents of
linkname, which will be executed like this: server.execute(page)
if ipage not exist then - see if the filename being
called exists, if not
ipage = "home.asp" - use home.asp
end if
endif
You see, if server.execute is given a blank field to parse, it returns an
error. Thus I need to know if the file being called actually exists or not.
And to keep a list of say over 2000 pages long in a case statement is not
going to work. Rather check if the file being called exists, if it doesn't
use home.asp as default.
--
Kind Regards
Rudi Ahlers
+27 (82) 926 1689
Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
"Roland Hall" <nobody@nowhere> wrote in message
news:...
"Rudi Ahlers" wrote in message news:HvadnSvs0ZcIruXdRVn-...
: I have the following link:
http://hobbit/newhp/index.asp?l=advert, and it
: doesn't do what I want it to do, even though the file exists.
: If a file doesn't exist, it should use home.asp as default, yet it uses
: home.asp as default regardless if the file exists or not?
: Here is the script:
:
:
: linkname = request.QueryString("l")
:
: if linkname <> "" then
: page = linkname & ".html"
: If objFSO.FileExists(page) = false Then
: page = "home.asp"
: End If
: end if
:
: If
http://hobbit/newhp/index.asp?l=advert123 (which doesn't exist) it goes
: to home.asp, which is what I want, but it also does it for all the files
: that does exist, and reason for that?
Your code reads as:
linkname=advert123
if linkname not empty then
page = advert.html
if advert.html not exist then
page = home.asp
end if
endif
That's why it always hits the home page when the tested file is not present
although the redirect is not shown here.
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library -
http://msdn.microsoft.com/library/default.asp