Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Request.QueryString variable 1

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
Hi all
How do i delete/remove a Querystring variable.
say Request.QueryString["ID"]);
i have tried this Request.QueryString["ID"].Remove(0) but it didnt remove it nor did it give an error message.
I also tried Request.QueryString.Clear(); and the error was the variable is readonly.
 
what are you trying to do? I ask because what you are trying to do doesn't make sense. QueryStrings are part of the request from the client. The request should not be modified by the server, it should only be interpreted to form a Response. The Response is sent to the client.

Email is a good analogy. You wouldn't delete part of email (Request) before reading it. When you respond to the email(Request) you don't modify the original. You form a new email (Response) and send that back.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I've seen stuff like this in javascript.

<script language="javascript" type="text/javascript">
//this is a workaround to remove everything from the querystring
document.forms[0].action = "yourpage.aspx";
</script>

You can still retrieve the querystring in your code.
 
this works because the request has not be created yet. on the form is submitted the request will be constructed without any querystrings.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top