' do not display link to the current page
If InStr(1, Request.ServerVariables("URL"), "menu.asp") = 0 Then
Response.Write "<a href=""menu.asp"">Menu</a>"
End If
And this works!
Sometimes!
Unfortunately it only works second time round, if I follow a the link to
menu.asp from the page menu.asp - then the link isn't displayed like I would
expect. Basically the code above only works when the referring page is the
same as the current page.
Any ideas appreciated,
Paul
Try setting a variable with the page name at the top of the page. You
can still leave the script in an include, but the page name is
supplied by the page in a variable.
pagename = "menu.asp"
....
If pagename <> "menu.asp" then
...
Using the URL in this manner is okay, but is not the best use of
objects.
GB
Yes, this workaround does fix the problem.
Presumably this is a bug in ASP then?
Thanks
Paul
>
>Yes, this workaround does fix the problem.
>Presumably this is a bug in ASP then?
>
>Thanks
>
>Paul
>
>
>
>
Paul:
Not sure if it is a bug or not. It is more a performance issue to me.
Since hardcoding the name of the page is not really any worse than
getting URL, why have the expense of calling the object when you can
pull a variable. I will see if I can find any info on the Server
variable URL, however, because I am curious.
GB
A friend who uses O'Reilly's Website, not IIS (as I do), could not replicate
the problem.
Paul
Worked it out!!
It works if I use the vbTextCompareOption in InStr (to force case
insensitivity), as Request.ServerVariables("URL") doesn't work properly.
I had tried all combinations of cases but was getting unpredictable results.
The reason is this: Request.ServerVariables("URL") capitalises the filename
part of it's output when the referring page is different to the current
page. Otherwise it makes it all lower case. Quite ridiculous really.
Paul