Ideal way of posting a value to a new page?

S

Satish Appasani

Is there any ideal way of passing values to another page using Post method
and avoiding Sessions and Viewstate?

I have used Viewstate unsuccessfully. Though I've set all the required
attributes to the form including enableviewstatemac property to false. But
it did not work.

The I used the following code:
In the source page add the code:

Me.Context.Items.Add("Value", txtValue.Text)

In the destination page add the code :

Me.Context.Items.Item("Value").ToString

This was working on my machine but when I moved it to the client's server, I
was getting error "Viewstate corrupted". I felt the problem was with the
client's .NET Framework version. They use 1.0 whereas I use 1.1. So, atlast
I pulled in the Session. This was working fine. After I use the data fetched
by the session, I am putting the value in the ViewState of the destination
form and killing the session (Session("ID") = Nothing). Now, If I click on
the browser's refresh button, my application does not work because I don't
have the value in the session. And the Viewstate also does not contain the
stored value wither.

I can't retain the value in the session because else where in the
application I am opening the same page but then don't pass any values.

I was thinking there should be an ideal way to post values to a new page
other than using Viewstate and Session.

--


Thank you.

Satish Appasani
#201, Wing - 1, Block - D
Cyber Gateway
Hyderabad - 500 081, India
Phone: +91(40)2311-1356 Ext-122
Mobile: +91(40)333-31032
E-mail: (e-mail address removed)
 
N

Natty Gur

Hi,

If I understood you correctly you trying to pass a Form data from page
to page (using server.transfer ?) and getting invalid viewstate. If this
is the case the reason is related to the fact that the target page tries
to get the last state of controls from the forms __viewsatate field but
the control tree of the target page don’t match the control tree stored
in __viewstate. You can workaround it by sending the Form as an object
in the Context object and get its values in the target page.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top