Click to See Complete Forum and Search --> : Syntax Error Response.Redirect


dollworld
10-09-2004, 01:46 AM
I am redirecting to another page using the below code:
<%
Response.Redirect("processType.asp?ProductID=Session("HDProductID")&ProcessType=Session("HDProcessType")");
%>
and get the following error

Microsoft JScript compilation (0x800A03EE)
Expected ')'
/anlaby/processBead.asp, line 49, column 54
Response.Redirect("processType.asp?ProductID=Session("HDProductID")&ProcessType=Session("HDProcessType")");

Help would be appreciated

buntine
10-09-2004, 03:50 AM
Ok, your getting this error because the JScript engine is treating everything between the initial quotes as a string literal. So when you call the Session variable, it thinks you are terminating the string.

to solve this, you need to use string concatenation, which just means you have to join the string literal with value of the Session variable. JScript uses the addition character (+) for this.

<%
Response.Redirect("processType.asp?ProductID=" + Session("HDProductID") + "&ProcessType=" + Session("HDProcessType"));
%>

Regards.