Getting a huge number of paramters from nowhere

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?
 
B

bruce barker

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)
 
S

Scott M.

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
 
K

K Viltersten

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!
 
T

Teemu Keiski

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top