Request.Querystring.Set

Octopus

New member
Joined
Apr 8, 2003
Messages
3
Hello,

When I try to use the Request.Querystring.Set method, I get the error:

: Collection is read-only.

Is this not the method to use to set a key/value pair in the collection from within the code?

Thanks in advance,
Octopus
 
The QueryString collection is read-only. Youll have to copy each element to a new NameValueCollection if you wish to modify anything.
 
When the protected property IsReadOnly is set to true it would be impossible to simply remove the Set method. In other words, a methods visibility can not depend on the value of a property, nor any other factor. The method will always be visible.

Under most cases IsReadOnly is set to false, and the collection can be modified using Set(). However, in a unique case such as this, Microsoft deemed it necessary to disallow modifications to the collection, since that would lead to confusion as to what function those modifications would serve.
 
Back
Top