Getting a huge number of paramters from nowhere

  • Thread starter Thread starter K Viltersten
  • Start date Start date
K

K Viltersten

I discovered that when requested

http://localhost:52698/ws3/page.aspx

and issued a call

Response.Write(Request.Params.Count);

i got 50 parameters in count. When i
actually added some as in

http://localhost:52698/ws3/page.aspx?key=some

the number increased by two to 52. I'd
be delighted if somebody enlighten me
in this matter.

1. Why is it an increase by two? Is it
because the "key" and "some" are counted
as separate paramters?

2. Where in Gods love are the first
fifty parameters?!

3. Should i use Request.Params or is
there something more recommended, e.g.
Request.QueryString?
 
well Request.Params is a combined collection of Server, Form, QueryString,
Cookie and Server variables, so 50 is not a large count (most are server
variables).

you got 2 addition, because adding a querystring added the query string to
the server variables collection, and the parsing the query string added a
parameter to the querystring collecton.


-- bruce (sqlwork.com)
 
K Viltersten said:
By that logic, i'd expect the parameters passed into the
page using the exclamation mark to be at index 51 and 52 but they seem to
be at index 0 and 1. Comments?

There's a difference between parameters "passed into the page" and
parameters in general. Server variables are not passed via the URL. They
are exchanged via request/response headers.
Perhaps it's a matter of term confusion - is the part after
the exclamation mark called "querry string"?

Not the exclamation mark (!), the question mark (?). And yes, what comes
after the question mark is the querystring, so you are seeing indexes
referring to the querystring parameters.


-Scott
 
well Request.Params is a combined collection
There's a difference between parameters
"passed into the page" and parameters in
general. Server variables are not passed via
the URL. They are exchanged via
request/response headers.

Right. Got it!
Not the exclamation mark (!), the question
mark (?).

Of course. Silly me...
...what comes after the question mark is the
querystring, so you are seeing indexes
referring to the querystring parameters.

Thanks. It helped!
 
In addition to what others have already said, by enabling page tracing (set
Trace="true" to @Page directive), you can see what these parameters in
different collections are.
 
Back
Top