22 November, 2007

Action-like URL

In VBScript, in an ASP page, I was looking for a way to declare a querystring parameter without giving it a specific value. In the requested page, I just wanted to check the presence of that particular parameter. My URL looks like this :


The presence of the autoplay parameter indicate to comprendre.asp to run the first flash video once the page is loaded. Requesting comprendre.asp directly would result in no specific action after the load.

Believe me, it was not easy to test the difference between a querystring parameter that has no value and no parameter at all !
You have to play with :

<> ""
and so on...

The best way I found was : Not IsEmpty(request.querystring("autoplay"))

1 comment:

Anonymous said...

For this particular case, I use (C# syntax) :
string myParameter = request.querystring("autoplay") + String.Empty;

And then, I test with : if (myParameter.Length > 0) ...