473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clear QueryString on PostBack?

Howdy,

Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to appear in the url anymore. How can I get rid of it? A postback doesn't clear it, it just keeps tagging along. I tried Request.QuerySt ring.Clear, but get "readonly" errors.

I want to do this, because eventually I use server.transfer within this page, and the querystring, tags along to new page as well, even after a postback on this new page. I start to get problems when, from second page, I perform a server.transfer back to the first page. My problems are explainable, if the querystring was empty, the page would work properly, but since the querystring is set, my page essentially breaks. I'm not too concerned about this, because if I could get rid of the querystring, I wouldn't have this problem!

Thanks for any help on this,
--Michael
Nov 18 '05 #1
4 19754
Michael,

The Server.Transfer method has an overload that allows you to specify
whether the querystring and form data should be preserved or not. Using
this appropriately should give the result you desire. Otherwise, might a
client-side redirection work for at least one of your two transfers?

HTH,
Nicole
"Raterus" <ra*****@spam.o rg> wrote in message
news:eY******** ******@TK2MSFTN GP12.phx.gbl...
Howdy,

Simple question, but I can't figure out how to do it. I have a a page which
is called initially with a querystring. After I get the querystring values,
I don't need the querystring to appear in the url anymore. How can I get
rid of it? A postback doesn't clear it, it just keeps tagging along. I
tried Request.QuerySt ring.Clear, but get "readonly" errors.

I want to do this, because eventually I use server.transfer within this
page, and the querystring, tags along to new page as well, even after a
postback on this new page. I start to get problems when, from second page,
I perform a server.transfer back to the first page. My problems are
explainable, if the querystring was empty, the page would work properly, but
since the querystring is set, my page essentially breaks. I'm not too
concerned about this, because if I could get rid of the querystring, I
wouldn't have this problem!

Thanks for any help on this,
--Michael
Nov 18 '05 #2
Never knew it had that option, but unfortunately that doesn't help, as the default is "false".
I think my more explain my problem now by this example, take server.transfer out of it. After my page that uses the querystring is rendered, this appears in the html source. The postback uses the querystring, I don't want it to.

<form name="Form1" method="post" action="manage. aspx?docID=40" id="Form1">
I want it to say this
<form name="Form1" method="post" action="manage. aspx" id="Form1">

Any ideas how I can clear the querystring from being rendered like this?

--Michael

"Nicole Calinoiu" <ni*****@somewh ere.net> wrote in message news:es******** ******@TK2MSFTN GP12.phx.gbl...
Michael,

The Server.Transfer method has an overload that allows you to specify
whether the querystring and form data should be preserved or not. Using
this appropriately should give the result you desire. Otherwise, might a
client-side redirection work for at least one of your two transfers?

HTH,
Nicole


"Raterus" <ra*****@spam.o rg> wrote in message
news:eY******** ******@TK2MSFTN GP12.phx.gbl...
Howdy,

Simple question, but I can't figure out how to do it. I have a a page which
is called initially with a querystring. After I get the querystring values,
I don't need the querystring to appear in the url anymore. How can I get
rid of it? A postback doesn't clear it, it just keeps tagging along. I
tried Request.QuerySt ring.Clear, but get "readonly" errors.

I want to do this, because eventually I use server.transfer within this
page, and the querystring, tags along to new page as well, even after a
postback on this new page. I start to get problems when, from second page,
I perform a server.transfer back to the first page. My problems are
explainable, if the querystring was empty, the page would work properly, but
since the querystring is set, my page essentially breaks. I'm not too
concerned about this, because if I could get rid of the querystring, I
wouldn't have this problem!

Thanks for any help on this,
--Michael

Nov 18 '05 #3
Hi

You can change the Action attribute of the form through client-side script
Please see this article on Microsoft Support
PRB: Cannot Change or Remove the QueryString Action for a Web Form on Postbac
http://support.microsoft.com/default...kb;en-us;81021

Bin Song, MCP
Nov 18 '05 #4
the only way to clear the querystring is a redirect. the browser does not
know you do a server transfer, it just remembers what the url (including
query string) was for the postback. to clear it you send the browser a
redirect, so that the new rendered page matchs the new url.

-- bruce (sqlwork.com)
"Raterus" <ra*****@spam.o rg> wrote in message
news:eY******** ******@TK2MSFTN GP12.phx.gbl...
Howdy,

Simple question, but I can't figure out how to do it. I have a a page which
is called initially with a querystring. After I get the querystring values,
I don't need the querystring to appear in the url anymore. How can I get
rid of it? A postback doesn't clear it, it just keeps tagging along. I
tried Request.QuerySt ring.Clear, but get "readonly" errors.

I want to do this, because eventually I use server.transfer within this
page, and the querystring, tags along to new page as well, even after a
postback on this new page. I start to get problems when, from second page,
I perform a server.transfer back to the first page. My problems are
explainable, if the querystring was empty, the page would work properly, but
since the querystring is set, my page essentially breaks. I'm not too
concerned about this, because if I could get rid of the querystring, I
wouldn't have this problem!

Thanks for any help on this,
--Michael
Nov 18 '05 #5

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

Similar topics

4
4941
by: moondaddy | last post by:
I'm passing a parameter in the url when I open up a particular page. When the page loads and finds this parameter, I know that I need to clear a variable out of the session cache and reset it with a new value. On the following postbacks I want this variable to remain constant which means I need to clear the parameter out of the URL before any of the postbacks occur. Otherwise if this parameter is still in the URL when the page loads...
3
2732
by: Alejandro Penate-Diaz | last post by:
Does anbody know how to clear the querystring between postbacks? tnx, alejandro.
3
2578
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes a postback to occur which in turn triggers a sub in a user control... Error: Argument not specified for parameter e of Public Sub UploadDate(Sender As
5
1473
by: Vishwanathan Raman | last post by:
I have only one page.Its a search results page.Depending on the component selected in the results page the search is initiated. I am using QueryString to send me details pertinent to search.But I need to have it cleared and not retain the values when its posted back. Can somebody throw some insight as to how to achieve this.
2
2795
by: lanem | last post by:
I have an asp.net 2.0 page with a couple of textboxes and a gridview. On postback from a rowcommand from the gridview, the textboxes are clearing out. No other postbacks from the page are causing this. There is NO code whatsoever that deals with these boxes. One of them is just a dummy I set up for troubleshooting. I type something in it and cause a postback from another control and the value is still there as it should be. Then, when...
11
14833
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be processed by the web server. I am still struggling to understand this postback logic, and hope that some kind gurus out there could help me clarify the confusion I have.
1
4676
by: prabhu A | last post by:
I have a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to appear in the url anymore. How can I get rid of it? A postback doesn't clear it, it just keeps tagging along. I tried Request.QueryString.Clear, but get "readonly" errors. Thank for your reply if any Prabhu
2
3932
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
6
15858
by: anthonykallay | last post by:
Hi there, I dont this this a bug but i cant get my head around it.. I have a master page that has a login control on it, to log in i press the button and the page posts back, however on the page that is derived from the master page (default.aspx) i have code that i dont want to run after the login button is pressed so i used the standard if(!Page.IsPostBack) {}
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10628
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.