Link to home
Create AccountLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Append parameter to redirect

I am trying to redirect to another page after inserting a value

 ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=<%=(rs_contact.Fields.Item('UserId').Value)%>"

Open in new window

But I am getting a syntax error. What would the correct syntax be ?

Using classic ASP.
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Aleks


It worked like this:

MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=" & (rs_contact.Fields.Item("UserId").Value)

I tried to add another parameter but my syntax did not work:

 MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=" & (rs_contact.Fields.Item("UserId").Value) & relation =" & Request("relation")

Open in new window

Sorry I should have asked with two parameters so I could add more later on if needed.
you're essentially concatenating a string, so your format should be:

varName = "some text" & aVariable & "some more text" & anotherVariable

you're missing a beginning quote on your second example, it should be:

MM_editRedirectUrl = "parties_SPaddlinks.asp?NewUserId=" & (rs_contact.Fields.Item("UserId").Value) & "relation =" & Request("relation")