473,587 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding name-value pair to QueryString Collection?

Joe
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId ) the first time that it is posted. After the user filles in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe
Feb 8 '06 #1
6 1784
Didn't understand.
When you call Response.Redire ct, you says that a function that recreates
query string is called. Can't you place _formSessionId= something as a
parameter for next page?
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:CE******** *************** ***********@mic rosoft.com...
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId ) the first time that it is posted. After the user filles
in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add
the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe

Feb 8 '06 #2
Joe
Hi Ravi.

Thanks for your response. Please see below. I would appreciate any more
help that you can offer.
--
Joe
"Ravi Ambros Wallau" wrote:
Didn't understand.
When you call Response.Redire ct, you says that a function that recreates
query string is called. Can't you place _formSessionId= something as a
parameter for next page?
The function is called in the Button's click event when the form posts back
to the server. I need it before the function is called. I need it in the
page's Load event.

Basically what I want to do is check the QueryString in the Load event for
the FormSessionId key. If it's there, I'll use it to retrieve some data for
the page. If it's not, I'll retrieve it from the database and add it to the
QueryString's NameValue collection.
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?
How would you do this? More importantly, how would you make this custom
collection the QueryString?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...
I agree that Session would be best, but I can't use Session, Cache,
ViewSatte, etc. I must use QueryString or hidden field. Client Requirement.

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:CE******** *************** ***********@mic rosoft.com...
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId ) the first time that it is posted. After the user filles
in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add
the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe


Feb 8 '06 #3
Hey Joe :-) (that's a great song)
Well, now I think that I understand what you want to do...
No way to change QueryString, it's read only and that's your problem...
I would make a copy of Query String collection to a hashtable and then,
in the page load event, would check if the formSessionId variable is set or
not...
And I would use this Hashtable in the method that re-generates the query
string, to pass it to the next page...

It's not much harder to do, and as far as I know there's no other way
(there are other ways, but are simillar to this)...

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:89******** *************** ***********@mic rosoft.com...
Hi Ravi.

Thanks for your response. Please see below. I would appreciate any more
help that you can offer.
--
Joe
"Ravi Ambros Wallau" wrote:
Didn't understand.
When you call Response.Redire ct, you says that a function that recreates
query string is called. Can't you place _formSessionId= something as a
parameter for next page?


The function is called in the Button's click event when the form posts
back
to the server. I need it before the function is called. I need it in the
page's Load event.

Basically what I want to do is check the QueryString in the Load event for
the FormSessionId key. If it's there, I'll use it to retrieve some data
for
the page. If it's not, I'll retrieve it from the database and add it to
the
QueryString's NameValue collection.
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?


How would you do this? More importantly, how would you make this custom
collection the QueryString?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...


I agree that Session would be best, but I can't use Session, Cache,
ViewSatte, etc. I must use QueryString or hidden field. Client
Requirement.

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:CE******** *************** ***********@mic rosoft.com...
> Hello All:
>
> I have a webform (WebForm1.aspx) that retrieves a value from a database
> (_formSessionId ) the first time that it is posted. After the user
> filles
> in
> the form, he/she clicks a Button server control that ultimately
> redirects
> him/her to WebForm2.aspx [using
> Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
> re-creates the QueryString **)].
>
> I need to persist the value of _formSessionId between the initial post
> and
> the postback (after the Button control is clicked). I would like to
> add
> the
> value to the QueryString collection, since I will need the value in
> WebForm2.aspx. I, however, have found that the QueryString's NameValue
> collection is read-only.
>
> Does anyone know how I can do this? Is there a better way?
> --
> Joe


Feb 8 '06 #4
Joe
Hey Ravi.

One more question: is my only option to navigate to the next page
Response.Redire ct or are there others ?
--
Joe
"Ravi Ambros Wallau" wrote:
Hey Joe :-) (that's a great song)
Well, now I think that I understand what you want to do...
No way to change QueryString, it's read only and that's your problem...
I would make a copy of Query String collection to a hashtable and then,
in the page load event, would check if the formSessionId variable is set or
not...
And I would use this Hashtable in the method that re-generates the query
string, to pass it to the next page...

It's not much harder to do, and as far as I know there's no other way
(there are other ways, but are simillar to this)...

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:89******** *************** ***********@mic rosoft.com...
Hi Ravi.

Thanks for your response. Please see below. I would appreciate any more
help that you can offer.
--
Joe
"Ravi Ambros Wallau" wrote:
Didn't understand.
When you call Response.Redire ct, you says that a function that recreates
query string is called. Can't you place _formSessionId= something as a
parameter for next page?


The function is called in the Button's click event when the form posts
back
to the server. I need it before the function is called. I need it in the
page's Load event.

Basically what I want to do is check the QueryString in the Load event for
the FormSessionId key. If it's there, I'll use it to retrieve some data
for
the page. If it's not, I'll retrieve it from the database and add it to
the
QueryString's NameValue collection.
Can't you have a custom collection (that is a copy of the QueryString
collection) to do that, and is editable?


How would you do this? More importantly, how would you make this custom
collection the QueryString?
And, the better thing to do, why don't you use a Session to persist data
between different posts? It's the better way to do this.
It will be automatically loaded when you get into there...


I agree that Session would be best, but I can't use Session, Cache,
ViewSatte, etc. I must use QueryString or hidden field. Client
Requirement.

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:CE******** *************** ***********@mic rosoft.com...
> Hello All:
>
> I have a webform (WebForm1.aspx) that retrieves a value from a database
> (_formSessionId ) the first time that it is posted. After the user
> filles
> in
> the form, he/she clicks a Button server control that ultimately
> redirects
> him/her to WebForm2.aspx [using
> Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
> re-creates the QueryString **)].
>
> I need to persist the value of _formSessionId between the initial post
> and
> the postback (after the Button control is clicked). I would like to
> add
> the
> value to the QueryString collection, since I will need the value in
> WebForm2.aspx. I, however, have found that the QueryString's NameValue
> collection is read-only.
>
> Does anyone know how I can do this? Is there a better way?
> --
> Joe


Feb 8 '06 #5
Why not just concatenate it with the url, for instance
"Webform2.aspx? sessid=" + _formSessionId.

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:CE******** *************** ***********@mic rosoft.com...
Hello All:

I have a webform (WebForm1.aspx) that retrieves a value from a database
(_formSessionId ) the first time that it is posted. After the user filles
in
the form, he/she clicks a Button server control that ultimately redirects
him/her to WebForm2.aspx [using
Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
re-creates the QueryString **)].

I need to persist the value of _formSessionId between the initial post and
the postback (after the Button control is clicked). I would like to add
the
value to the QueryString collection, since I will need the value in
WebForm2.aspx. I, however, have found that the QueryString's NameValue
collection is read-only.

Does anyone know how I can do this? Is there a better way?
--
Joe

Feb 8 '06 #6
You haver Server.Transfer as well...
Response.Redire ct is processed in the browser;
Server.Transfer is processed at the server (the new page is processed and
the result of that page is passed to the browser, as it was the result of
the first page request) - it's faster, but I don't know if it's the best
choice (history, etc...)

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:77******** *************** ***********@mic rosoft.com...
Hey Ravi.

One more question: is my only option to navigate to the next page
Response.Redire ct or are there others ?
--
Joe
"Ravi Ambros Wallau" wrote:
Hey Joe :-) (that's a great song)
Well, now I think that I understand what you want to do...
No way to change QueryString, it's read only and that's your
problem...
I would make a copy of Query String collection to a hashtable and
then,
in the page load event, would check if the formSessionId variable is set
or
not...
And I would use this Hashtable in the method that re-generates the
query
string, to pass it to the next page...

It's not much harder to do, and as far as I know there's no other way
(there are other ways, but are simillar to this)...

"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:89******** *************** ***********@mic rosoft.com...
> Hi Ravi.
>
> Thanks for your response. Please see below. I would appreciate any
> more
> help that you can offer.
> --
> Joe
>
>
> "Ravi Ambros Wallau" wrote:
>
>> Didn't understand.
>> When you call Response.Redire ct, you says that a function that
>> recreates
>> query string is called. Can't you place _formSessionId= something as a
>> parameter for next page?
>
> The function is called in the Button's click event when the form posts
> back
> to the server. I need it before the function is called. I need it in
> the
> page's Load event.
>
> Basically what I want to do is check the QueryString in the Load event
> for
> the FormSessionId key. If it's there, I'll use it to retrieve some
> data
> for
> the page. If it's not, I'll retrieve it from the database and add it
> to
> the
> QueryString's NameValue collection.
>
>> Can't you have a custom collection (that is a copy of the QueryString
>> collection) to do that, and is editable?
>
> How would you do this? More importantly, how would you make this
> custom
> collection the QueryString?
>
>> And, the better thing to do, why don't you use a Session to persist
>> data
>> between different posts? It's the better way to do this.
>> It will be automatically loaded when you get into there...
>
> I agree that Session would be best, but I can't use Session, Cache,
> ViewSatte, etc. I must use QueryString or hidden field. Client
> Requirement.
>
>>
>> "Joe" <Jo*@discussion s.microsoft.com > wrote in message
>> news:CE******** *************** ***********@mic rosoft.com...
>> > Hello All:
>> >
>> > I have a webform (WebForm1.aspx) that retrieves a value from a
>> > database
>> > (_formSessionId ) the first time that it is posted. After the user
>> > filles
>> > in
>> > the form, he/she clicks a Button server control that ultimately
>> > redirects
>> > him/her to WebForm2.aspx [using
>> > Response.Redire ct(String.Conca t("WebForm2.asp x?", **a function that
>> > re-creates the QueryString **)].
>> >
>> > I need to persist the value of _formSessionId between the initial
>> > post
>> > and
>> > the postback (after the Button control is clicked). I would like to
>> > add
>> > the
>> > value to the QueryString collection, since I will need the value in
>> > WebForm2.aspx. I, however, have found that the QueryString's
>> > NameValue
>> > collection is read-only.
>> >
>> > Does anyone know how I can do this? Is there a better way?
>> > --
>> > Joe
>>
>>
>>


Feb 8 '06 #7

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

Similar topics

0
1189
by: Iker Arizmendi | last post by:
Hello all. Is there a convenient scheme within a C extension to add methods to a type in such a way as to allow me to transparently add a "proxy" around them? For example: typedef PyObject* (*PyMethodCall)(PyObject*, PyObject*); PyObject* middleMan(PyObject* self, PyObject* args) { printf("Before call to wrapped funct\n");
0
1084
by: John Smith | last post by:
When the code below runs, I get the error: "cannot convert from 'System.Web.UI.WebControls.BoundField' to 'System.Web.UI.WebControls.DataGridColumn'" Is adding a BoundField different than adding a BoundColumn? I cannot find any websites that say otherwise. DataGrid gvViewAll = new DataGrid(); gvViewAll.AutoGenerateColumns = false;
2
6147
by: David Williams | last post by:
I have a simple XML file that I have been using: <component name="test"> <class name="class"/> <component> Up till now, the Xpath of "//component/class" worked well to select the <class> tag. Recently we added a namespace to the <component> tag:
3
4901
by: Raj | last post by:
Hi, I am trying to add some more information to the table which already has a lot a data (like 2-3000 records). The new information may be adding 2-3 new columns worth. Now my questions are: (1)Is it a good idea to add new columns to the existing table? then it will create these new columns for all old records, will it not result in wasting...
2
3716
by: avivgur | last post by:
Hello, I am writing a program in Visual C# and I have encountered a problem. In my program I want to dynamically create a multitude of controls (thousands) on a form. The problem is that calling the Controls.Add() method several times or even calling the Controls.AddRange() method once can take a huge amount of time. Therefore, I would like to...
1
1130
by: Asha | last post by:
Hello, below is a xml file which I’m working with. I want my result to be like this <group name="grp 4"> <report> <name>MTIS_1</name> </report> <report> <name>MTIS_1</name> </report />
47
3331
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols are objects whose representation within the code is more important than their actual value. Two symbols needs only to be
4
3714
by: glebur | last post by:
Hi, I'm trying to create a web service client in C# but I get stuck at one of the first steps. When adding a Web reference to the Visual Studio project; I get this error (this is a translation, the English terms might not be exact) : "Error in the custom tool : Impossible to import WebService/Schema. Impossible to import binding...
4
2108
by: thoseion | last post by:
Hi, I am trying to get a program working whereby directory and file names are read into a list. I have been given the original list structure - it appears that the directory names should be added to the list, then the filenames added to another separate but connected list within each directory node. So far I have the program working in...
3
1631
by: raylopez99 | last post by:
Oh, I know, I should have provided complete code in console mode form. But for the rest of you (sorry Jon, just kidding) I have an example of why, once again, you must pick the correct entry point in your code when adding a class (oops, I meant variable, or instantiation of a object that's a class) to a form constructor. Specifically,...
0
7849
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...
0
8215
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. ...
1
7973
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...
0
6626
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...
0
3844
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...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
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
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
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...

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.