Request.QueryString.Set() Read Only?

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi-

I'd like to set values in the QueryString if I detect that a user submits a
bad value, say... ?id=333 where there is no id '333', I would like to set it
to '0' for example.
I tried to use Request.QueryString.Set("id", "0");

it says it is Read Only. How can this be done? Why is there a Set() method
if you can't use it?

Thanks,
Steve
 
Steve,
It has a Set method because the querystring is a
NameValueCollection. Inherently, this has a Set method. The querystring
overrides this and disables it. The querystring is basically non-touchable
since you can't alter what is sent from the browser.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
I have capture the query string like

qs=request.querystring().tostring

and then rebuilt the query string with modified values
and response.redirect(url & qs) to it
 
You will also notice that when you make any change to "qs" that it doesn't
change the Request.QueryString value.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top