472,348 Members | 1,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

How can I duplicate the form data?

I want to duplicate the form data, edit it to remove some items (such
as __EVENTTARGET, __EVENTVALIDATION, etc) and save it to a log.

How can I make a duplicate (editable) copy of the Form Collection?

The Form Collection is of type NameValueCollection is, underneath the
covers, an object of type HttpValueCollection.

The problem I have is that my copies have only one key item for a list
(such as a radio button list) whereas the Form has one key per item in
the collection (duplicate keys).

Apart from doing something like:

string aCopy = myForm.ToString();

and then rebuilding the NameValueCollection how can I make an editable
duplicate with duplicate keys for lists?

myForm is passed into a method so:

public void TheHeader(NameValueCollection myForm)
{
...

the calling code is:

SomeClass.TheHeader(Request.Form);

When this happens the resulting myForm is read only.

The code within TheHeader could be:

NameValueCollection nvc = new NameValueCollection();
foreach (string key in myForm)
nvc.Add(key, myForm[key]);

or below which duplicates the above (using the 1st contructor of the
Add method rather than 2nd):

NameValueCollection nvc = new NameValueCollection();
nvc.Add(Request.Form)

No matter how the Form is copied the copy isn't the same because the
original Form has a separate key for each item in a collection (such
as a radio button list). The copy (nvc) will contain only one key
followed by a comma separated value list.

If I serialise it to a string and then use split to put it into an
array how can I be sure that the viewstate and other asp.net fields
won't this up by using the special characters & = , used to delimit
the keys and data?
May 4 '07 #1
2 2437
Just get them all and ignore what you want when dumping to the log file ?

It could be just done in global.asax using the request.form collection (if I
understand what you are trying to do) so that it is easily
changed/removed/added as needed.

(My understanding is that you want just to keep track of posted values in a
server side log.)

"Harry Haller" <Ha***@Steppenwolf.coma écrit dans le message de news:
2c********************************@4ax.com...
>I want to duplicate the form data, edit it to remove some items (such
as __EVENTTARGET, __EVENTVALIDATION, etc) and save it to a log.

How can I make a duplicate (editable) copy of the Form Collection?

The Form Collection is of type NameValueCollection is, underneath the
covers, an object of type HttpValueCollection.

The problem I have is that my copies have only one key item for a list
(such as a radio button list) whereas the Form has one key per item in
the collection (duplicate keys).

Apart from doing something like:

string aCopy = myForm.ToString();

and then rebuilding the NameValueCollection how can I make an editable
duplicate with duplicate keys for lists?

myForm is passed into a method so:

public void TheHeader(NameValueCollection myForm)
{
...

the calling code is:

SomeClass.TheHeader(Request.Form);

When this happens the resulting myForm is read only.

The code within TheHeader could be:

NameValueCollection nvc = new NameValueCollection();
foreach (string key in myForm)
nvc.Add(key, myForm[key]);

or below which duplicates the above (using the 1st contructor of the
Add method rather than 2nd):

NameValueCollection nvc = new NameValueCollection();
nvc.Add(Request.Form)

No matter how the Form is copied the copy isn't the same because the
original Form has a separate key for each item in a collection (such
as a radio button list). The copy (nvc) will contain only one key
followed by a comma separated value list.

If I serialise it to a string and then use split to put it into an
array how can I be sure that the viewstate and other asp.net fields
won't this up by using the special characters & = , used to delimit
the keys and data?

May 4 '07 #2
The following doesn't work either:

NameValueCollection nvc = new NameValueCollection(myForm);

once again the resulting collection has only one key for a radio
button list values rather than a key per entry (as in the original
form).

May 4 '07 #3

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

Similar topics

1
by: marx | last post by:
I have a bit of a problem and any help would be much appreciated. Problem: I have two dropdown list boxes with same data(all data driven). These...
2
by: Pablo | last post by:
Hello, there, I have a table tblData which has pharmacy data. The table has following fields: ClaimNum, LineNum... The ClaimNum has claim...
3
by: Donna Price | last post by:
I have a problem with a database which I've recently separated into several related tables. I have a main data entry form, which has several...
8
by: Mark | last post by:
When my form goes to a new record, I have a procedure that copies the last record added to the form's underlying table into the form. The intent is...
0
by: Suler Abou | last post by:
Hi, I'm having a problem with an SQL statement, I have a statement that goes like this: "INSERT INTO table VALUES('TransID','CID',etc...);" ...
8
by: Ray | last post by:
I have a data input form and need to automatically duplicate the existing record as a new record by clicking a button. The main purpose to...
6
by: planetthoughtful | last post by:
Hi All, I have a C# ASP.NET page that submits back to itself to insert details from a form into a database table. When / if the user refreshes...
6
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user...
2
by: fabiola1 | last post by:
I'm using Ms Access 2003. I have five tables called tblAllContract tblType tbInteranlContact tblSupplier tblManager The other four tables...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.