Query value is passed correctly but does not return any results in the query API string
-
I have a form that submit a query to an API. the parameter is passed correctly to the next page and I can print it as a test, but it is not passed to the API query
q='%"&Request.QueryString("id")&"%'
sometimes the result is just generic and does not include the query parameter. I can print it and the parameter is definitely passed to the page but it is just ignored or return an error: System.NullReferenceException: Object reference not set to an instance of an object. Any ideas on how to fix this? not sure if it is a formatting issue or the way the page is loaded.
This requests the query parameter and displays it on the page as a test (correct value is returned)
Form page:
dim intID as String
intID = Request.QueryString("id")
Response.write(intID)Result Page:
This is the Query Parameter section:
Dim doc As New XmlDocument()
doc.Load("http://api.tradedoubler.com/1.0/products.xml; q='%"&Request.QueryString("id")&"%';tdCategoryId=168;%20category=test?token=B17495243749DAC9660980F6FB98495928DDX123")So when I use the browser - copy the link to the url with a parameter e.g. q=spain, I get the correct results but when embedded in the asp.net page, it doesn't work
-
I have a form that submit a query to an API. the parameter is passed correctly to the next page and I can print it as a test, but it is not passed to the API query
q='%"&Request.QueryString("id")&"%'
sometimes the result is just generic and does not include the query parameter. I can print it and the parameter is definitely passed to the page but it is just ignored or return an error: System.NullReferenceException: Object reference not set to an instance of an object. Any ideas on how to fix this? not sure if it is a formatting issue or the way the page is loaded.
This requests the query parameter and displays it on the page as a test (correct value is returned)
Form page:
dim intID as String
intID = Request.QueryString("id")
Response.write(intID)Result Page:
This is the Query Parameter section:
Dim doc As New XmlDocument()
doc.Load("http://api.tradedoubler.com/1.0/products.xml; q='%"&Request.QueryString("id")&"%';tdCategoryId=168;%20category=test?token=B17495243749DAC9660980F6FB98495928DDX123")So when I use the browser - copy the link to the url with a parameter e.g. q=spain, I get the correct results but when embedded in the asp.net page, it doesn't work
hm9 wrote:
http://api.tradedoubler.com/1.0/products.xml; q='%spain%';tdCategoryId=168;%20category=test?token=B17495243749DAC9660980F6FB98495928DDX123
That doesn't look like a valid URL. Compare it to the working URL you're loading in the browser.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
hm9 wrote:
http://api.tradedoubler.com/1.0/products.xml; q='%spain%';tdCategoryId=168;%20category=test?token=B17495243749DAC9660980F6FB98495928DDX123
That doesn't look like a valid URL. Compare it to the working URL you're loading in the browser.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
The Url could be valid, but Request.Querystring("q") can't find "Q" because the call just parses the Url for "/?" and "&" It can find it if the Url was shaped like this
http://api.tradedoubler.com/1.0/products.xml?q=spain&c=seville
Otherwise you would have to write some custom code to parse your Url the way you have it formatted.
If it ain't broke don't fix it Discover my world at jkirkerx.com