Append parameter to redirect

Aleks
Aleks used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Web Ninja at large
Commented:
try:

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

Author

Commented:
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.
Big MontyWeb Ninja at large

Commented:
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")

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial