471,319 Members | 2,201 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

append to query string

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
Jan 26 '06 #1
4 9084
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"netnet" wrote:
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

Jan 26 '06 #2
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
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:D4**********************************@microsof t.com...
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"netnet" wrote:
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

Jan 26 '06 #3
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
--
Joerg Jooss
ne********@joergjooss.de
Jan 26 '06 #4
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


"Joerg Jooss" wrote:
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
--
Joerg Jooss
ne********@joergjooss.de

Jan 27 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Danny | last post: by
reply views Thread by karinski | last post: by
5 posts views Thread by solar | last post: by
7 posts views Thread by Tobiah | last post: by
2 posts views Thread by SolomonShavitzMetsFan | last post: by

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.