How to Retrieve parameter value and append it to a URL

I want to retrieve values from one page and append to a url on the second page. the url link oepn an API page.

The first part works so I can retrieve the value but i cant append the value to the URL so the API search doesnt show any data. it works manually

so pages 1 contains a form with the search paramaeter that is passed to page 2

response.redirect ("page2.aspx?id=" & search.Text & " ")

Page 2

dim intID as String
intID = Request.QueryString("id")
 Response.write(intID) (this is to test it works)
doc.Load("http://api.something.com/1.0/products.xml;q='& Response.write(Request.QueryString("id")&' ;tdCategoryId=163 etc")

so the value of parameter q doesnt not return anything. if I add it manaually on the page q = hotels, it shows data but when I pass the same value via id from page 1, nothing is returned.

so not sure if the syntax is incorrect or something else. any help would be appreciated

Thanks

Yes, your syntax is incorrect there. And you already have it in intID, so just re-use it

doc.Load("http://api.something.com/1.0/products.xml?q="& intID &"&CategoryId=163")

Alternatively, you can use String.format. Not sure on the exact VB syntax, but something like this:

doc.Load(String.Format("http://api.something.com/1.0/products.xml?q={0}&tdCategoryId={1}", intID, catId))

I hope this helps

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.