> There needs to be an equals (=) sign after each key name.
I think it would be pretty rare for a web application that expects a user to
be creating their "own" querystrings. You can type whatever gobbledegook you
want after a URI in the Address Bar of your browser, and the browser will
happily attempt to retrieve the resource for you. Cheers.
-- Peter
To be a success, arm yourself with the tools you need and learn how to use
them.
Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net
> > There needs to be an equals (=) sign after each key name.
>
[quoted text clipped - 7 lines]
>
> /Peter
Peter - 26 Apr 2008 12:33 GMT
> I think it would be pretty rare for a web application that expects a
> user to be creating their "own" querystrings. You can type whatever
> gobbledegook you want after a URI in the Address Bar of your browser,
> and the browser will happily attempt to retrieve the resource for
> you.
I don't know if we're talking/writing past each other here... but it
was never the idea that a user should write parameters in the url in
the browser. However, one of our users did (for their own nefarious
reasons), and that's when we discovered an error in our program.
The user wrote a query like "?a&b&c=123". It could very well be this is
an invalid query. The browser though, as you wrote, happily sent this
invalid query to our web-app.
The web-app received that invalid query, and as part of its normal
processing used the AllKeys property of
HttpContext.Current.Request.QueryString to loop over all the keys. This
caused an unhandled error in our program because we were not aware that
a key could be null.
We are now aware of this fact, and have corrected our program to not
attempt to process any null keys. I am still surprised that AllKeys can
return a key which is null, but that's just life I guess :-)
Thanks,
Peter
> > There needs to be an equals (=) sign after each key name.
>
[quoted text clipped - 7 lines]
>
> /Peter
Hi,
Then you are playing with fire, just be ready for a var not to be
present, or as in your first post an incorrect QS.
Peter - 29 Apr 2008 12:26 GMT
> > > There needs to be an equals (=) sign after each key name.
> >
[quoted text clipped - 12 lines]
> Then you are playing with fire, just be ready for a var not to be
> present, or as in your first post an incorrect QS.
Yes, thanks, we've fixed our application now.
I guess QueryString interprets "a" and "b" in "localhost?a&b&c=123" as
values which don't have a parameter name.
I thought they'd be interpreted as parameter names which don't have any
values - but that would be "?a=&b=".
I may even use this at some stage if I can't think of a good name for a
parameter and I just want to send some values to my web-app.
Thanks,
Peter