How does Viewstate do it?

  • Thread starter Thread starter Raterus
  • Start date Start date
R

Raterus

Hi,

I've got a crazy idea, but I think I can get it to work, I just need some help.

I want to maintain a datarow across browser sessions. I have a screen where a user will submit some information, but before that data is updated in the database, it needs to be "approved".

I want to know what exactly viewstate is doing to turn that datarow into an encoded string of junk, and then what it does on the return trip to turn it back into the original object.

I want to do just that, just not use the viewstate, but my own routines. I have the idea that if I can encode the information they submit to a string of junk, I can then send an email to the approval people with the information they submitted, and a hyperlink to a webpage with this string of junk in the querystring. If they click it, it is an approval, I have all the information I need in this datarow to update the database. This information is just name/address/telephone, so it shouldn't fill up the querystring limit.

Basically I'm trying to avoid the use of a temporary table to store this information until someone can approve it. Yeah yeah, I know that is the easiest way, but this way is more elegant.

Any ideas?
--Michael
 
I believe the ViewState is simply a Base64-encoded representation of string
data. You can use the Static Convert.ToBase64String() and
Convert.FromBase64String( ) methods to get data into and out of the "encoded
string of junk" format to which you refer.

Good Luck!




Hi,

I've got a crazy idea, but I think I can get it to work, I just need some
help.

I want to maintain a datarow across browser sessions. I have a screen where
a user will submit some information, but before that data is updated in the
database, it needs to be "approved".

I want to know what exactly viewstate is doing to turn that datarow into an
encoded string of junk, and then what it does on the return trip to turn it
back into the original object.

I want to do just that, just not use the viewstate, but my own routines. I
have the idea that if I can encode the information they submit to a string
of junk, I can then send an email to the approval people with the
information they submitted, and a hyperlink to a webpage with this string of
junk in the querystring. If they click it, it is an approval, I have all
the information I need in this datarow to update the database. This
information is just name/address/telephone, so it shouldn't fill up the
querystring limit.

Basically I'm trying to avoid the use of a temporary table to store this
information until someone can approve it. Yeah yeah, I know that is the
easiest way, but this way is more elegant.

Any ideas?
--Michael
 
Raterus,

Can you assure that, the user who approves the row will be online
anytime, If so, that's OK.

If there will be a period of delay, I advise you add some field like
"Deal Flag" to the table. When you have a lot of concurrent users,
Session usage like your idea will make your server down, If the target user
will come back to online system 2 or 3 days later.

Anyway, your idea is sure to be right. You will do it.

Edward

--------------------
Hi,

I've got a crazy idea, but I think I can get it to work, I just need some
help.

I want to maintain a datarow across browser sessions. I have a screen where
a user will submit some information, but before that data is updated in the
database, it needs to be "approved".

I want to know what exactly viewstate is doing to turn that datarow into an
encoded string of junk, and then what it does on the return trip to turn it
back into the original object.

I want to do just that, just not use the viewstate, but my own routines. I
have the idea that if I can encode the information they submit to a string
of junk, I can then send an email to the approval people with the
information they submitted, and a hyperlink to a webpage with this string of
junk in the querystring. If they click it, it is an approval, I have all
the information I need in this datarow to update the database. This
information is just name/address/telephone, so it shouldn't fill up the
querystring limit.

Basically I'm trying to avoid the use of a temporary table to store this
information until someone can approve it. Yeah yeah, I know that is the
easiest way, but this way is more elegant.

Any ideas?
--Michael
 

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