I am editing other people's code, written in server-side JS for ASP, and have run into a problem that probably has a very simple solution.
I'm outputting some code from a URL param like this:
<%=Request.QueryString("param")%>
The problem is that if the param doesn't exist, I need to do something else. So I tried:
<%
var param = Request.QueryString("param");
if (!param) { param = "Some Default Value"; }
%>
<%=param%>
The problem is that the if
never seems to evaluate to true
, even when the URL param is missing. I'm guessing that the !image
condition doesn't work here. What should my test condition be?
(Please forgo stern warnings about doing escaping of URL params to prevent XSS.)