473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Request.QueryString.Set() Read Only?

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
Nov 18 '05 #1
4 13135
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

"Steve" <st***@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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

Nov 18 '05 #2

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

-----Original Message-----
Steve,
It has a Set method because the querystring is a
NameValueCollection. Inherently, this has a Set method. The querystringoverrides this and disables it. The querystring is basically non-touchablesince you can't alter what is sent from the browser.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Steve" <st***@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi-

I'd like to set values in the QueryString if I detect
that a user submitsa
bad value, say... ?id=333 where there is no id '333', I
would like to setit
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

.

Nov 18 '05 #3

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

-----Original Message-----
Steve,
It has a Set method because the querystring is a
NameValueCollection. Inherently, this has a Set method. The querystringoverrides this and disables it. The querystring is basically non-touchablesince you can't alter what is sent from the browser.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Steve" <st***@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi-

I'd like to set values in the QueryString if I detect
that a user submitsa
bad value, say... ?id=333 where there is no id '333', I
would like to setit
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

.

Nov 18 '05 #4
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.

<an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...

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

-----Original Message-----
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

"Steve" <st***@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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

.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
4
by: Max | last post by:
Hello. This is the first time I've posted to a newsgroup, and I do this because I'm in desperate need of help. I'm working a user management system, and when I activate a user that has registered...
2
by: Gus Gustafson | last post by:
I set ndi in a repost of a page: window.location.href= '../Test/test.aspx' + '?ndi=' + theform.domain_SELECT.options.selectedIndex; In the test.aspx.cs code-behind, I test if ndi is set as ...
4
by: Steve | last post by:
Hi All, This problem is really annoying me, as I am sure there is a simple solution to it. If I try to read a querystring value in the Page_Load event and that querystring does not exist I...
8
by: George | last post by:
VS.NET 2002/VB Is it possible to retrieve HTML form variables that are hidden input types using Request.QueryString() and/or Request.Form()? I have tried various ways of using those, but to no...
2
by: mahsa | last post by:
Hi have have some link like thi http://x.com/Shoppingcart.aspx?pn=ps50210&qty_ps50210=1&pn=excel&qty_excel=1&pn=l4504000&qty_l4504000=1&sku=PS50210&cat=laminate&action=updat now I want to request...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
4
by: Lu | last post by:
Hi, i am currently working on ASP.Net v1.0 and is encountering the following problem. In javascript, I'm passing in: "somepage.aspx?QSParameter=<RowID>Chèques</RowID>" as part of the query...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Make CStr for JavaScript on ASP w/ Request.Form and QueryString In ASP, Request.Form and Request.QueryString return objects that do not support "toString", or any JavaScript string...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.