append to query string

  • Thread starter Thread starter netnet
  • Start date Start date
N

netnet

Hi,
I have an asp.net page that has a save method. I would like to append
to the querystring at the end of the save method, before the page reloads.
Is there a way to do this without using Server.Transfer?


Thanks

Sean
 
You don't have to use the querystring to pass values back to the page. You
can use the HttpContext Items collection, hidden form fields, Session, Cache,
or even ViewState.
Aside from that, I can't think of any other way besides Response.Redirect.

Peter
 
Thank you Peter, I was looking for something that would actually place a
value in the querystring, not hide it in the form, or server memory. I
wanted to use the query string so that a user would have something to
bookmark, sorry I didnt make my objective more clear in my inital post. I
thought since the QueryString was simply a collection there would be a way
to .Add() to that collection.


Sean
 
Hello netnet,
Thank you Peter, I was looking for something that would actually place
a value in the querystring, not hide it in the form, or server memory.
I wanted to use the query string so that a user would have something
to bookmark, sorry I didnt make my objective more clear in my inital
post. I thought since the QueryString was simply a collection there
would be a way to .Add() to that collection.

The QueryString represents what you received in the HTTP request and is immutable.
In order to change the QueryString, you'd have to redirect to your page using
a URL that includes the updated QueryString. This of course requires an extra
round trip.

Cheersm
 
The Request.QueryString is actually a NameValueCollection. However, if you
are building a new Uri you will need to write custom code that accepts name
and value parameters (for example, as a NameValueCollecition input parameter,
constructs the querystring, and returns the complete uri string to the caller
of the method.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top