0

I have a URL like so: www.domain.com/thispage.asp?param1&param2=test&param3=airplanes

A couple questions:

  1. Expectedly, I cannot access Request.QueryString("param1"), but I also cannot access any null keys. How do I get this value? The URI can't change unfortunately.

  2. When I iterate through the parameters for the keys, it shows I only have two: param1&param2 and param3. It's like the ampersand does not distinguish between parameters and so it sees that as one key. How can I get the values of the first two parameters? I don't want to use regex if I don't have to.

For the third parameter in this example, Request.QueryString("param3") works as it should.

Many thanks in advance.

Edit: My question is different, I've read the other post linked and like I stated above, I can't access a null key. Also, I have to use parenthesis to access the keys, not brackets. We are not using c#, so apologies if I tagged this incorrectly (I frankly don't know all the differences). Also, as stated, we cannot change the URI by adding a "=" or anything else - it will have multiple parameters, with one being just a plain value (or key, whatever it's called in this case).

One more thing I should add: When the URL is simply www.domain.com/thispage.asp?param1, then Request.QueryString is equal to "param1"

10
  • The URI would need to be param1=&, I think. Or just omit param1 from the request entirely if it isn't populated. Commented Jul 22, 2019 at 23:14
  • 1
    P.S. you talk about a URL with .asp extension, usually indicating ASP Classic, but then tagged the question with ASP.NET. They are very different beasts. Which one are you really using here? Commented Jul 22, 2019 at 23:17
  • 1
    @ElasticCode only if it really is ASP.NET ...see my comment above. Although ASP Classic may well behave in a similar way, I wouldn't be surprised. Commented Jul 22, 2019 at 23:20
  • The second answer from ElasticCodes link really looks promising Commented Jul 23, 2019 at 5:10
  • Can you elaborate on "but I also cannot access any null keys"? Commented Jul 23, 2019 at 5:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.