473,840 Members | 1,600 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 19755
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
4942
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
2579
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
2799
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
14842
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
4678
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
9860
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
10301
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
9440
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
7838
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...
0
5685
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4076
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3138
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.