Well, this is a self-reply to my own question, but I'm going to post it because I think it may be useful to someone facing the same problem, or someone may find a way to improve it.
I have reached a partial solution to the problem, and I think that this is caused by how the Apache server handles ASP objects.
The problem was that if I typed Request.QueryString("HolidayLocation").Count=0 the server would send the message
Apache Active Scripting Runtime Error
Object required: 'Request.QueryString(...)'
Line #11, Char #2
But if I typed Request.QueryString.Count=0, then the answer changed. If I selected one city, it would give me the correct output, such as
We will send you details on Rome as requested.
If I selected more than one city, it would only "read" the first of them. For example, if I selected Madrid and Paris, the output would be
We will send you details on Madrid as requested, and If I didn't select any city, instead of the expected output, which should be
"We won't send you any details " I got this
We will send you details on as requested.
I could therefore select one city and get the correct output, but if I selected more than one or none at all the output would be somehow wrong.
The next thing I tried was to create a variable, strLocation, and give it the value of Request.QueryString("HolidayLocation") I then changed the code to look like this;
<%
Dim strLocation
strLocation = Request.QueryString("HolidayLocation")
If strLocation = "" then
Response.Write "We won't send you any details"
Else
Response.Write "We will send you details on "
Response.Write Request.QueryString("HolidayLocation")
End If
%>
as requested.
By doing this, I could still only select one city, if I selected two or more, only the first would be recognised, but if I didn't select any city I would now get the correct output.
I guess I could mask the inconvenience by modifying the code in a way that only allow the user to select one city at a time, but that, of course, is not the objective of the exercise.
I would welcome any help on this, and also any insight on how Apache or any other server handles VBscript and ASP.
Thank you,
Paco.
|